Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 committed Sep 24, 2023
2 parents 6585dc2 + 758695a commit 4b5accd
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
TCX_OUT
FIT_OUT
Workouts
scripts/data.db
run_page/data.db
src/static/activities.json
imported.json
key: ${{ inputs.data_cache_prefix }}-${{ github.sha }}-${{ github.run_id }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run_data_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
TCX_OUT
FIT_OUT
Workouts
scripts/data.db
run_page/data.db
src/static/activities.json
imported.json
key: ${{ env.DATA_CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
Expand All @@ -100,9 +100,9 @@ jobs:
- name: Run sync Strava script
if: env.RUN_TYPE == 'strava'
run: |
python scripts/strava_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}
python run_page/strava_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}
# If you only want to sync `type running` add args --only-run, default script is to sync all data (rides and runs).
# python scripts/garmin_sync.py ${{ secrets.GARMIN_EMAIL }} ${{ secrets.GARMIN_PASSWORD }} --only-run --is-cn
# python run_page/garmin_sync.py ${{ secrets.GARMIN_EMAIL }} ${{ secrets.GARMIN_PASSWORD }} --only-run --is-cn

- name: Run sync Codoon script
if: env.RUN_TYPE == 'codoon'
Expand Down Expand Up @@ -132,12 +132,12 @@ jobs:
- name: Run sync Only FIT script
if: env.RUN_TYPE == 'only_fit'
run: |
python scripts/fit_sync.py
python run_page/fit_sync.py
- name: Run sync Only TCX script
if: env.RUN_TYPE == 'only_tcx'
run: |
python scripts/tcx_sync.py
python run_page/tcx_sync.py
- name: Run sync Strava to Garmin(Run with strava(or others upload to strava) data backup in Garmin)
if: env.RUN_TYPE == 'strava_to_garmin'
Expand Down
14 changes: 8 additions & 6 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,17 +787,19 @@ python3(python) run_page/gen_svg.py --from-db --type circular --use-localtime
<summary> 使用 Cloudflare 部署 </summary>
<br>

1. `Pages` 中点击 `Create a project` 以连接到你的仓库
1. 登录到 [Cloudflare 仪表板](https://dash.cloudflare.com)

2. 点击 `Begin setup` 后,修改项目的 `Build settings`
2. 在左侧选择 `Workers 和 Pages`

3. `Framework preset` 中选择 `Create React App` 框架
3. 点击 `创建应用程序` 后选择 `Pages` 页面,链接您的 GitHub 账户并选择 `running_page` 仓库,点击 `开始设置`

4. 向下滚动,点击 `Environment variables` 修改变量如下:
4. 下滑到 `构建设置`,在 `框架预设` 中选择 `Create React App`,将 `构建输出目录` 设置为 `dist`

> Variable name = `PYTHON_VERSION`, Value = `3.7`
5. 下滑点击 `环境变量 (高级)`,并添加一个如下的变量:

5. 点击 `Save and Deploy`,完成部署。
> 变量名称 = `PYTHON_VERSION`, 值 = `3.7`
6. 点击 `保存并部署`,完成部署。

</details>

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,19 @@ For more display effects, see:
<summary> Use <code> Cloudflare </code> to deploy </summary>
<br>

1. Click `Create a project` in `Pages` to connect to your Repo.
1. Login to [Cloudflare dashboard](https://dash.cloudflare.com).

2. After clicking `Begin setup`, modify Project's `Build settings`.
2. Click `Workers & Pages` on the left side.

3. Select `Framework preset` to `Create React App`
3. Click `Create application` and select `Pages` tab, connect your GitHub account and select `running_page` Repo, then click `Begin setup`.

4. Scroll down, click `Environment variables`, then variable below:
4. Scroll down to `Build settings`, choose `Create React App` from `Framework preset`, and set `Build output directory` to `dist`.

5. Click `Save and Deploy`
5. Scroll down, click `Environment variables (advanced)`, then add a variable like below:

> Variable name = `PYTHON_VERSION`, Value = `3.7`
6. Click `Save and Deploy`

</details>

Expand Down
37 changes: 21 additions & 16 deletions run_page/keep_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,28 @@ def parse_raw_data_to_nametuple(
):
raw_data_url = run_data.get("rawDataURL")
r = session.get(raw_data_url)
# string strart with `H4sIAAAAAAAA` --> decode and unzip
run_points_data = decode_runmap_data(r.text)
run_points_data_gpx = run_points_data
if TRANS_GCJ02_TO_WGS84:
run_points_data = [
list(eviltransform.gcj2wgs(p["latitude"], p["longitude"]))
for p in run_points_data
]
for i, p in enumerate(run_points_data_gpx):
p["latitude"] = run_points_data[i][0]
p["longitude"] = run_points_data[i][1]
if r.ok:
# string strart with `H4sIAAAAAAAA` --> decode and unzip
run_points_data = decode_runmap_data(r.text)
run_points_data_gpx = run_points_data
if TRANS_GCJ02_TO_WGS84:
run_points_data = [
list(eviltransform.gcj2wgs(p["latitude"], p["longitude"]))
for p in run_points_data
]
for i, p in enumerate(run_points_data_gpx):
p["latitude"] = run_points_data[i][0]
p["longitude"] = run_points_data[i][1]
else:
run_points_data = [
[p["latitude"], p["longitude"]] for p in run_points_data
]
if with_download_gpx:
if str(keep_id) not in old_gpx_ids:
gpx_data = parse_points_to_gpx(run_points_data_gpx, start_time)
download_keep_gpx(gpx_data, str(keep_id))
else:
run_points_data = [[p["latitude"], p["longitude"]] for p in run_points_data]
if with_download_gpx:
if str(keep_id) not in old_gpx_ids:
gpx_data = parse_points_to_gpx(run_points_data_gpx, start_time)
download_keep_gpx(gpx_data, str(keep_id))
print(f"ID {keep_id} retrieved gpx data failed")
heart_rate = None
if run_data["heartRate"]:
heart_rate = run_data["heartRate"].get("averageHeartRate", None)
Expand Down

0 comments on commit 4b5accd

Please sign in to comment.