Open melimelo24 opened 11 months ago
Answering my own question if anyone is interested too :) Added this after the def load_zones functions: `def load_sets(activity_id, start_time_seconds, args, http_caller, file_writer): """ :param activity_id: ID of the activity (as string) :param start_time_seconds: if given use as timestamp for the file written (in seconds since 1970-01-01) :param args: command-line arguments (for the file_writer callback) :param http_caller: callback to perform the HTTP call for downloading the device details :param file_writer: callback that saves the device details in a file :return: array with the heart rate sets """ sets = [None] sets_json = http_caller(f'{URL_GC_ACTIVITY}{activity_id}/exerciseSets') sets = json.loads(sets_json) if sets['exerciseSets'] == None:
logging.warning("Sets %s are empty", activity_id)
else:
# We only write sets if they are not empty
file_writer(os.path.join(args.directory, f'activity_{activity_id}_sets.json'), sets_json, 'w', start_time_seconds)
`
And call it under extract['HRzones'] with this:
load_sets(str(actvty['activityId']), start_time_seconds, args, http_req_as_string, write_to_file)
It will write a separate json with exercises sets if it exists
Is there any way to get the exercises sets and names for activities with this script (cardio, yoga, strength training activities)? Those are available on the page of the activity:
I tried to extract it directly from .fit files but unfortunately only the original info from the watch is present, not any modifications done on garmin connect (and I think most people need to update their data after, to correct exercises or reps). Someone made a browser extension in javascript to get those (https://github.com/labsansis/garmin-workout-downloader) so I think it's possible (it's very nice but does not have all the data and flexibility of this script especially for non gym&fitness activities). I tried coding something myself using that as a template but, hum, I am not that good (although still trying).
The information is stored in https://connect.garmin.com/activity-service/activity/${activityId}/exerciseSets