-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix codoon and Upload tcx_to_garmin #662
Conversation
also modify some format problem when uploading the tcx file export from codoon.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
nice pr will take a look tonight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice code
run_page/codoon_sync.py
Outdated
activity_creator = ET.Element( | ||
"Creator", | ||
{ | ||
"xsi:type": "Device_t" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能取个更有表示点的名字么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能取个更有表示点的名字么?
我打开佳明的tcx这部分长这样:
<Creator xsi:type="Device_t">
<Name>Forerunner 945</Name>
<UnitId>********</UnitId>
<ProductID>****</ProductID>
<Version>
<VersionMajor>13</VersionMajor>
<VersionMinor>0</VersionMinor>
<BuildMajor>0</BuildMajor>
<BuildMinor>0</BuildMinor>
</Version>
</Creator>
应该不能改成其他的样子了。
- name: Run sync Oppo heytap script, note currently this script is not worked | ||
if: env.RUN_TYPE == 'oppo' | ||
run: | | ||
python run_page/oppo_sync.py ${{ secrets.OPPO_ID }} ${{ secrets.OPPO_CLIENT_SECRET }} ${{ secrets.OPPO_CLIENT_REFRESH_TOKEN }} --with-tcx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not support gpx right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not support gpx right?
代码可以先放上来,现在内部消息是这个oppo heytap健康的数据暂时还没有完全对外开放,不过在计划中了。我的代码是--with-tcx、--with-gpx都可以的。需要更新一下说明不?
run_page/codoon_sync.py
Outdated
xmlstr = minidom.parseString(ET.tostring(training_center_database)).toprettyxml(indent=" ", encoding="UTF-8") | ||
with open(TCX_FOLDER + "/" + fit_id + ".tcx", "w") as f: | ||
f.write(str(xmlstr.decode("UTF-8"))) | ||
f.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not need close here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not need close here
python里面写文件的流最后不用关么?因为我平时用java多一点,写完流必须要关。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got reference here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with
statements handle the close automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the lint using black
to pass the CI
run_page/codoon_sync.py
Outdated
xmlstr = minidom.parseString(ET.tostring(training_center_database)).toprettyxml(indent=" ", encoding="UTF-8") | ||
with open(TCX_FOLDER + "/" + fit_id + ".tcx", "w") as f: | ||
f.write(str(xmlstr.decode("UTF-8"))) | ||
f.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with
statements handle the close automatically
run_page/codoon_sync.py
Outdated
author_lang.text = "en" | ||
author.append(author_lang) | ||
author_part = ET.Element("PartNumber") | ||
author_part.text = "006-D2449-00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this string to a variable and leave a comment specifying which Garmin device it is for.
scope: subject:
Let me check it locally before submitting PR again. |
just continue commit is Ok~~ |
Please review again. Thx @yihong0618 @ben-29 |
""" | ||
file_names = os.listdir(TCX_FOLDER) | ||
tcx = TCXReader() | ||
tcx_files = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the TCX_FOLDER is empty?
|
||
|
||
if __name__ == "__main__": | ||
if not os.path.exists(TCX_FOLDER): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ben-29 Please have a look at here. If TCX_FOLDER does not exit, we'll create first.
|
||
dict(sorted(tcx_files_dict.items())) | ||
|
||
return tcx_files_dict.values() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the TCX_FOLDER is empty, we'll get an empty result. And it's OK. @ben-29
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job
* yihong0618-master: (33 commits) Fix codoon and Upload tcx_to_garmin (yihong0618#662) Update README-CN.md (yihong0618#663) add keep2strava (yihong0618#653) Add data to 'running page runners' table (yihong0618#656) style: use Tailwind CSS (yihong0618#655) feat: fill country (yihong0618#654) docs: add runner (yihong0618#651) doc: add new runner docs: update README (yihong0618#650) docs: add a comment in `src/utils/consts.ts` to remind about security considerations regarding the `MAPBOX_TOKEN` (yihong0618#644) fix: no package manager fix: tachyons-sass import error (yihong0618#639) Update README.md (yihong0618#638) Add proxy config, add keep config, change npm registry, use yarn (yihong0618#634) chore: fix typo (yihong0618#633) chore: Update package manager and ignore requirements-dev.txt (yihong0618#632) add run.drink.cafe (yihong0618#628) feat: coros sync (yihong0618#623) Fix README typo (yihong0618#624) fix: ts type error (yihong0618#622) ...
* refs/heads/upstream: (71 commits) Add laqieer's running page to README (yihong0618#672) chore: add raycast extension support (yihong0618#670) add </details> (yihong0618#669) fix the deprecation warning (yihong0618#668) Fix codoon and Upload tcx_to_garmin (yihong0618#662) Update README-CN.md (yihong0618#663) add keep2strava (yihong0618#653) Add data to 'running page runners' table (yihong0618#656) style: use Tailwind CSS (yihong0618#655) feat: fill country (yihong0618#654) docs: add runner (yihong0618#651) doc: add new runner docs: update README (yihong0618#650) docs: add a comment in `src/utils/consts.ts` to remind about security considerations regarding the `MAPBOX_TOKEN` (yihong0618#644) fix: no package manager fix: tachyons-sass import error (yihong0618#639) Update README.md (yihong0618#638) Add proxy config, add keep config, change npm registry, use yarn (yihong0618#634) chore: fix typo (yihong0618#633) chore: Update package manager and ignore requirements-dev.txt (yihong0618#632) ... # Conflicts: # run_page/gpxtrackposter/track.py # run_page/keep_sync.py
* add oppo_sync and tcx_to_garmin.py also modify some format problem when uploading the tcx file export from codoon. * 修改readme.md * 修复CI遇到的问题,已经根据评审修改相关的代码 * 解决运行时参数少了的异常 * Optimise the lap details in tcx file. * type: 修改漏掉的文件 scope: subject: * 完善代码逻辑 * 修改代码漏洞 * 修改oppo的请求接口地址 * 解决编译问题 * 解决咕咚tcx生成异常问题,同时解决当前存在的CI问题 * 使用black完成代码format
Closes #645