pe-st / garmin-connect-export

Download a copy of your Garmin Connect data, including stats and GPX tracks.
MIT License
370 stars 76 forks source link

csv file is populated with already downloaded activities #34

Closed cristian5th closed 3 years ago

cristian5th commented 4 years ago

Hello all.

When executing the script on already downloaded activities, the file will not be re-downloaded again, but the activity data will be appended to the csv file, creating doubles and worst.

I find solution to be pretty simple but I don't know how to propose it via GitHub. This has always been a big mystery to me. Do you know to point me to some instructions for dummies?

I'm just adding a return TRUE or FALSE to the function export_data_file. FALSE is returned when the file already exists; TRUE is returned at any other case.

In the main program, I also invert the functions to write the file and write the csv data with an if clause, like this:

# Save the file and inform if it already existed. If the file already existed, do not append the record to the csv
if export_data_file(str(actvty['activityId']), activity_details, args, start_time_seconds, append_desc, actvty['startTimeLocal']):
    # Write stats to CSV.
    csv_write_record(csv_filter, extract, actvty, details, activity_type_name, event_type_name)

Thank you for all your work on this splendid script.

Best regards.

cristian5th commented 4 years ago

I found instructions on how to use GitHub at the file contributing.md

pe-st commented 3 years ago

MR https://github.com/pe-st/garmin-connect-export/pull/62 that fixes this is merged with f650c11db0f1d4993a5268ba74f7f3247faef38e