Skip to content

Commit

Permalink
fix: keep interface upgraded, retrieved gpx data maybe failed
Browse files Browse the repository at this point in the history
  • Loading branch information
F4ria committed Sep 23, 2023
1 parent 3e342dc commit ba008e7
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions run_page/keep_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,26 @@ 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.status_code == 200:
# 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 ba008e7

Please sign in to comment.