Skip to content

Commit

Permalink
feat: garmin - handle gpx(if exist) when sync with fit
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-29 committed Jan 4, 2024
1 parent 3f5a22a commit b10727c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions run_page/garmin_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ async def download_garmin_data(client, activity_id, file_type="gpx"):
os.path.join(folder, f"{activity_id}_ACTIVITY.fit"),
os.path.join(folder, f"{activity_id}.fit"),
)
elif file_info.filename.endswith(".gpx"):
os.rename(
os.path.join(folder, f"{activity_id}_ACTIVITY.gpx"),
os.path.join(FOLDER_DICT["gpx"], f"{activity_id}.gpx"),
)
else:
os.remove(os.path.join(folder, file_info.filename))
os.remove(file_path)
Expand Down Expand Up @@ -323,4 +328,7 @@ async def download_new_activities(
)
)
loop.run_until_complete(future)
# fit may contain gpx(maybe upload by user)
if file_type == "fit":
make_activities_file(SQL_FILE, FOLDER_DICT["gpx"], JSON_FILE, file_suffix="gpx")
make_activities_file(SQL_FILE, folder, JSON_FILE, file_suffix=file_type)

0 comments on commit b10727c

Please sign in to comment.