Skip to content

Commit

Permalink
Merge branch 'yihong0618:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fitconverter authored Sep 13, 2024
2 parents af03fc7 + 3a973b8 commit 0a6b548
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
with:
node-version: '20'

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
Expand All @@ -100,10 +100,10 @@ jobs:
run: PATH_PREFIX=/${{ github.event.repository.name }} pnpm build

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v4
52 changes: 48 additions & 4 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ R.I.P. 希望大家都能健康顺利的跑过终点,逝者安息。
| [Zeonsing](https://github.com/NoonieBao) | <https://run.jogzeal.com/> | Coros |
| [yaoper](https://github.com/yaoper) | <https://running.yaoper.cn> | codoon |
| [NoZTurn](https://github.com/NoZTurn) | <https://run.jiangkai.org> | Strava |
| [laqieer](https://github.com/laqieer) | <https://laqieer.github.io/running_page/> | Strava |
| [Guoxin](https://github.com/guoxinl) | <https://running.guoxin.space/> | Strava |
| [Darren](https://github.com/Flavored4179) | <https://run.wdoc.top/> | tcx |
</details>

## 它是怎么工作的
Expand Down Expand Up @@ -133,6 +136,7 @@ R.I.P. 希望大家都能健康顺利的跑过终点,逝者安息。
## 支持

- **[Strava](#strava)**
- **[New Way To Sync Nike Run Club](#nike-run-club-new)** :NFC同步的新方式
- **[Nike Run Club](#nike-run-club)**
- **[Garmin](#garmin)**
- **[Garmin-cn](#garmin-cn-大陆用户请用这个)**
Expand All @@ -146,7 +150,7 @@ R.I.P. 希望大家都能健康顺利的跑过终点,逝者安息。
- **[佳明国内同步国际](#Garmin-CN-to-Garmin)**
- **[Tcx+Strava(upload all tcx data to strava)](#tcx_to_strava)**
- **[Tcx+Garmin(upload all tcx data to Garmin)](#tcx_to_garmin)**
- **[Gpx+Strava(upload all tcx data to strava)](#gpx_to_strava)**
- **[Gpx+Strava(upload all gpx data to strava)](#gpx_to_strava)**
- **[Nike+Strava(Using NRC Run, Strava backup data)](#nikestrava)**
- **[Garmin_to_Strava(Using Garmin Run, Strava backup data)](#garmin_to_strava)**
- **[Strava_to_Garmin(Using Strava Run, Garmin backup data)](#strava_to_garmin)**
Expand Down Expand Up @@ -399,13 +403,13 @@ TRANS_GCJ02_TO_WGS84 = True
![image](https://user-images.githubusercontent.com/15976103/102352588-e3af3000-3fe2-11eb-8131-14946b0262eb.png)

```bash
python3(python) run_page/joyrun_sync.py ${your mobile} ${your 验证码}
python3(python) run_page/joyrun_sync.py ${your mobile} ${your 验证码} --athlete ${your own name}
```

示例:

```bash
python3(python) run_page/joyrun_sync.py 13333xxxx xxxx
python3(python) run_page/joyrun_sync.py 13333xxxx xxxx --athlete yihong0618
```

joyrun 导出 gpx 文件
Expand All @@ -432,6 +436,12 @@ python3(python) run_page/joyrun_sync.py 13333xxxx example --with-gpx
python3(python) run_page/joyrun_sync.py 1393xx30xxxx 97e5fe4997d20f9b1007xxxxx --from-uid-sid --with-gpx
```

> 支持配置min_grid_distance,默认为10
```bash
python3(python) run_page/joyrun_sync.py 13333xxxx xxxx --athlete yihong0618 --min_grid_distance 5
```

</details>

### Codoon(咕咚)
Expand Down Expand Up @@ -635,6 +645,34 @@ python3(python) run_page/garmin_sync_cn_global.py ${garmin_cn_secret_string} ${g

</details>

### Nike Run Club New

<details>
<summary>Get your <code>Nike Run Club</code> data</summary>

<br>

> Please note:由于nike run club已经在中国大陆停止运营,所以只能通过vpn的方式进行登录。在开始之前先确认自己是全局的非中国大陆的代理,能够正确的访问`nike.com`而不是`nike.com.cn` 如下图所示.
![nike.com](https://github.com/user-attachments/assets/8ce6ae8f-4bc6-4522-85ec-3e5b7590e96d)
<br>

1. 登录/注册 [NikeRunClub](https://www.nike.com/) 账号
![login](https://github.com/user-attachments/assets/659341fb-4abf-491e-bda7-bfca968921b3)
2. 登录成功后,键盘打开F12->Application->localstorage-> 复制键为`https://www.nike.com`的值中的`access_token`的内容.
![developer_mode](https://github.com/user-attachments/assets/c932318d-a123-4505-8fd8-b46946c25d29)
3. 修改 `nike_sync.py` 文件中的代码,并且把你刚才复制的内容粘贴进去 如下图所示.
![nike_sync.py](https://github.com/user-attachments/assets/6de91725-ed17-4338-96d5-727eb75cee24)
4. 在根目录执行,你应该就可以看到下图中的内容,然后你就可以正常在你的手机版NRC里登录你的账号了:

```bash
python3(python) run_page/nike_sync.py aaaaa
```
![tg_image_166091873](https://github.com/user-attachments/assets/9d4851d6-849a-4bb7-8ffe-5358fa7328b2)

如果你想自动化同步NRC中的运动数据,去 [issue692](https://github.com/yihong0618/running_page/issues/692#issuecomment-2218849713)中查看相关内容.

</details>

### Nike Run Club

Expand Down Expand Up @@ -780,6 +818,8 @@ python3(python) run_page/tcx_to_strava_sync.py xxx xxx xxx --all

> 如果你已经上传过需要跳过判断增加参数 `--all`
</details>

### TCX_to_Garmin

<details>
Expand Down Expand Up @@ -954,7 +994,7 @@ python3(python) run_page/keep_to_strava_sync.py ${your mobile} ${your password}
3. run_data_sync.yml中的修改:

```yaml
RUN_TYPE: keep_to_starva_sync
RUN_TYPE: keep_to_strava_sync
```
</details>
Expand Down Expand Up @@ -1184,6 +1224,10 @@ curl https://api.github.com/repos/yihong0618/running_page/actions/workflows -H "

谢谢就够了

# Raycast 插件

<a title="Install running-page Raycast Extension" href="https://www.raycast.com/Lemon/running-page"><img src="https://www.raycast.com/Lemon/running-page/[email protected]?v=1.1" height="64" alt="" style="height: 64px;"></a>

# FAQ

- Strava 100 每 15 分钟的请求,1000 每日限制
Expand Down
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ English | [简体中文](https://github.com/yihong0618/running_page/blob/master/
| [PPZ](https://github.com/8824PPZ) | <https://run.dudubbbbbbbbb.top/> | Strava |
| [Yer1k](https://github.com/Yer1k) | <https://running.yer1k.com/> | Strava |
| [AlienVision](https://github.com/weaming) | <https://run.drink.cafe/> | Strava |
| [闻笑忘](https://wenxiaowan.com) | <https://wenxiaowan.com> | 苹果健身 |
| [闻笑忘](https://wenxiaowan.com) | <https://wenxiaowan.com> | 苹果健身 |
| [Vensent](https://github.com/Vensent) | <https://vensent.github.io/workouts_page/> | Garmin |
| [Zeonsing](https://github.com/NoonieBao) | <https://run.jogzeal.com/> | Coros |
| [Zeonsing](https://github.com/NoonieBao) | <https://run.jogzeal.com/> | Coros |
| [yaoper](https://github.com/yaoper) | <https://running.yaoper.cn> | codoon |
| [laqieer](https://github.com/laqieer) | <https://laqieer.github.io/running_page/> | Strava |
| [Guoxin](https://github.com/guoxinl) | <https://running.guoxin.space/> | Strava |
| [laihj](https://github.com/laihj) | <https://run.laihjx.com/> | 苹果健身 |
| [Ginta](https://github.com/mar-heaven) | <https://running.ginta.top/> | Keep |
</details>

## How it works
Expand All @@ -122,6 +126,7 @@ English | [简体中文](https://github.com/yihong0618/running_page/blob/master/

- **[Garmin](#garmin)**
- **[Garmin-CN](#garmin-cnchina)**
- **[New Way To Sync Nike Run Club](#nike-run-club-new)**
- **[Nike Run Club](#nike-run-club)**
- **[Strava](#strava)**
- **[GPX](#gpx)**
Expand Down Expand Up @@ -434,6 +439,35 @@ python3(python) run_page/garmin_sync_cn_global.py ${garmin_cn_secret_string} ${g

</details>

### Nike Run Club New

<details>
<summary>Get your <code>Nike Run Club</code> data</summary>

<br>

> Please note:Due to the discontinuation of Nike Run Club in mainland China, you can only log in through a VPN. Before starting, please ensure that you are using a global non-mainland China proxy, allowing you to access `nike.com` instead of `nike.com.cn`, as shown in the following image.
![nike.com](https://github.com/user-attachments/assets/8ce6ae8f-4bc6-4522-85ec-3e5b7590e96d)
<br>

1. Sign in/Sign up [NikeRunClub](https://www.nike.com/) account
![login](https://github.com/user-attachments/assets/659341fb-4abf-491e-bda7-bfca968921b3)
2. after successful login,openF12->Application->localstorage-> copy the content of "access_token" from the value of key`https://www.nike.com`.
![developer_mode](https://github.com/user-attachments/assets/c932318d-a123-4505-8fd8-b46946c25d29)
3. modify the code in the "nike_sync.py" file and paste the content you just copied as shown in the following image.
![nike_sync.py](https://github.com/user-attachments/assets/6de91725-ed17-4338-96d5-727eb75cee24)
4. Execute in the root directory , you should be able to see the image below, and then you can log into your account on the mobile as usual:

```bash
python3(python) run_page/nike_sync.py aaaaa
```
![tg_image_166091873](https://github.com/user-attachments/assets/9d4851d6-849a-4bb7-8ffe-5358fa7328b2)

if you want to automate the submission of NRC data, you can refer to [issue692](https://github.com/yihong0618/running_page/issues/692#issuecomment-2218849713).

</details>

### Nike Run Club

<details>
Expand Down Expand Up @@ -971,6 +1005,10 @@ Before submitting PR:

Just enjoy it~

# Raycast Extension

<a title="Install running-page Raycast Extension" href="https://www.raycast.com/Lemon/running-page"><img src="https://www.raycast.com/Lemon/running-page/[email protected]?v=1.1" height="64" alt="" style="height: 64px;"></a>

# FAQ

- Strava Api limit
Expand Down
2 changes: 1 addition & 1 deletion assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/github_2024.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/year_2024.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Yi hong",
"version": "1.0.0",
"author": "Yi Hong <[email protected]>",
"packageManager": "[email protected]+sha256.8f5264ad1d100da11a6add6bb8a94c6f1e913f9e9261b2a551fabefad2ec0fec",
"dependencies": {
"@mapbox/mapbox-gl-language": "^1.0.0",
"@mapbox/polyline": "^1.1.1",
Expand All @@ -29,7 +30,7 @@
"private": true,
"type": "module",
"scripts": {
"data:clean": "rm run_page/data.db {GPX,TCX,FIT}_OUT/* activities/* src/static/activities.json",
"data:clean": "rm -f run_page/data.db {GPX,TCX,FIT}_OUT/* activities/* src/static/activities.json",
"data:download:garmin": "python3 run_page/garmin_sync.py",
"data:analysis": "python3 run_page/gen_svg.py --from-db --type github --output assets/github.svg",
"build": "vite build",
Expand Down
4 changes: 3 additions & 1 deletion run_page/generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def sync_from_data_dir(self, data_dir, file_suffix="gpx"):
synced_files = []

for t in tracks:
created = update_or_create_activity(self.session, t.to_namedtuple())
created = update_or_create_activity(
self.session, t.to_namedtuple(run_from=file_suffix)
)
if created:
sys.stdout.write("+")
else:
Expand Down
37 changes: 36 additions & 1 deletion run_page/gpxtrackposter/poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"special": "#FFFF00",
"track": "#4DD2FF",
}
self.special_distance = {"special_distance1": "10", "special_distance2": "20"}
self.special_distance = {"special_distance": 10, "special_distance2": 20}
self.width = 200
self.height = 300
self.years = None
Expand Down Expand Up @@ -155,6 +155,9 @@ def __draw_footer(self, d):
value_style = "font-size:9px; font-family:Arial"
small_value_style = "font-size:3px; font-family:Arial"

special_distance1 = self.special_distance["special_distance"]
special_distance2 = self.special_distance["special_distance2"]

(
total_length,
average_length,
Expand All @@ -179,6 +182,38 @@ def __draw_footer(self, d):
style=value_style,
)
)

d.add(
d.text(
self.trans("SPECIAL TRACKS"),
insert=(65, self.height - 20),
fill=text_color,
style=header_style,
)
)

d.add(d.rect((65, self.height - 17), (2.6, 2.6), fill=self.colors["special"]))

d.add(
d.text(
f"Over {special_distance1:.1f} km",
insert=(70, self.height - 14.5),
fill=text_color,
style=small_value_style,
)
)

d.add(d.rect((65, self.height - 13), (2.6, 2.6), fill=self.colors["special2"]))

d.add(
d.text(
f"Over {special_distance2:.1f} km",
insert=(70, self.height - 10.5),
fill=text_color,
style=small_value_style,
)
)

d.add(
d.text(
self.trans("STATISTICS"),
Expand Down
17 changes: 15 additions & 2 deletions run_page/gpxtrackposter/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self):
self.run_id = 0
self.start_latlng = []
self.type = "Run"
self.device = ""

def load_gpx(self, file_name):
"""
Expand Down Expand Up @@ -280,6 +281,14 @@ def _load_fit_data(self, fit: dict):
self.start_time, self.end_time, None
)

# The FIT file created by Garmin
if "file_id_mesgs" in fit:
device_message = fit["file_id_mesgs"][0]
if "manufacturer" in device_message:
self.device = device_message["manufacturer"]
if "garmin_product" in device_message:
self.device += " " + device_message["garmin_product"]

def append(self, other):
"""Append other track to self."""
self.end_time = other.end_time
Expand Down Expand Up @@ -319,10 +328,14 @@ def _get_moving_data(gpx):
),
}

def to_namedtuple(self):
def to_namedtuple(self, run_from="gpx"):
d = {
"id": self.run_id,
"name": "run from gpx", # maybe change later
"name": (
f"run from {run_from} by {self.device}"
if self.device
else f"run from {run_from}"
), # maybe change later
"type": "Run", # Run for now only support run for now maybe change later
"start_date": self.start_time.strftime("%Y-%m-%d %H:%M:%S"),
"end": self.end_time.strftime("%Y-%m-%d %H:%M:%S"),
Expand Down
Loading

0 comments on commit 0a6b548

Please sign in to comment.