From 2a2a414dc31a3d52ccee08161f6a0d441a33c99b Mon Sep 17 00:00:00 2001 From: wangwenqi Date: Tue, 23 Apr 2024 00:47:30 +0800 Subject: [PATCH] Provide another way to upload all kinds of sport type of TCX file to Strava. --- run_page/oppo_sync.py | 6 +++++- run_page/utils.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/run_page/oppo_sync.py b/run_page/oppo_sync.py index cf5bf803f6b..423903ebbf6 100644 --- a/run_page/oppo_sync.py +++ b/run_page/oppo_sync.py @@ -288,7 +288,7 @@ def get_all_oppo_tracks( ) tracks.append(track) except Exception as e: - print(f"Something wrong paring keep id {str(start)}-{str(end)}" + str(e)) + print(f"Something wrong paring keep id {str(start)}-{str(end)}, " + str(e)) return tracks @@ -408,6 +408,10 @@ def prepare_track_points(sport_data, with_gpx): for i in range(value_size): temp_timestamp = other_data.get("gpsPoint")[i]["timestamp"] + + if temp_timestamp not in timestamp_list: + continue + j = timestamp_list.index(temp_timestamp) points_dict = { diff --git a/run_page/utils.py b/run_page/utils.py index de6945ee48a..f0b3d955e13 100644 --- a/run_page/utils.py +++ b/run_page/utils.py @@ -92,7 +92,7 @@ def get_strava_last_time(client, is_milliseconds=True): return 0 -def upload_file_to_strava(client, file_name, data_type, force_to_run=True): +def upload_file_to_strava(client, file_name, data_type, force_to_run=False): with open(file_name, "rb") as f: try: if force_to_run: