Skip to content
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

#484 导出keep接口升级无法获取gpx数据的跑步记录 #496

Merged
merged 3 commits into from
Sep 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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