I just moved a LOT of gpx files to garmin connect (most pre-carmin connect) and the they are of course, un-uncategorized. I was wondering if there was a way to change a LOT of file categories at a time rather than one at a time?
I just moved a LOT of gpx files to garmin connect (most pre-carmin connect) and the they are of course, un-uncategorized. I was wondering if there was a way to change a LOT of file categories at a time rather than one at a time?
EDIT: TL;DR The latest script (2021-03-31) is here: https://pastebin.com/ZZW7qnFX
---
Original (outdated) comment:
Touch0Gray What activity type do you need? I've got a script to change all your activities…
worked with ptid = 17 which was what a correct run was logged with
only small note:
Not sure if "uncategorized" is correct. When I imported something like hiking or any other sports than running or biking, all has activity type "other" not "uncategorized"…
OK, I think I am not smart enough to get the script to work. I can get it to work by double-clicking it - but I would need to start it from command prompt to get the IDs. But I am unable to get it to work.
I have tons of activities categorized as "Other", and I want t change them to Badminton. Could somebody kindly tell me the three IDs I would need for that, if that's not too much trouble? Thank you!
OK, I think I am not smart enough to get the script to work. I can get it to work by double-clicking it - but I would need to start it from command prompt to get the IDs. But I am unable to get it to work.
I have tons of activities categorized as "Other", and I want t change them to Badminton. Could somebody kindly tell me the three IDs I would need for that, if that's not too much trouble? Thank you!
Sorry, I know the script is far from user-friendly, and it doesn't help that it's hosted on pastebin lol.
In your case, I would copy and paste the following command (all one line):
python3 gc-activity-type.py --match-activity-type other
--match-activity-type-id 4 --match-activity-parent-type-id 17
--activity-type badminton --activity-type-id 224
--activity-parent-type-id 219
Here's how I figured that out:
To figure out the IDs you need, I created two manual activities -- Other and Badminton -- and ran the script from the command line with the following parameters:
python3 gc-activity-type.py --startdate 2023-06-17 --dry-run
(--dry-run is the most important parameter, as it ensures that the script won't do anything other than list the type information about the selected activities.)
This was the output of the tool (I just pressed enter at the new activity type prompts to select "cycling", since no activities would actually be changed):
--dry-run specified. Activities will not be modified
Welcome to the Garmin Connect Activity Type Tool!
Enter new activity type: (default: cycling):
Selected new activity type: cycling
Enter new activity type ID: (default: 2):
Selected new activity type ID: 2
Enter new activity parent type ID: (default: 17):
Selected new activity parent type ID: 17
Username: willnorthyork
Password:
Select Activities
Up to 9999 activities can be processed at one time.
Leave the start date blank to start at the beginning.
Leave the end date blank to end at the latest activity.
End Date (e.g. "2018-10-30" or blank):
Logging in...
Searching for activities (this might take a while)...
Found 2 activities.
Activity: 2023-06-17 23:35:00 | test other | Type: other (typeId: 4, parentTypeId: 17)
(Dry run) would have set activity type to cycling (typeId: 2, parentTypeId: 17)
Activity: 2023-06-17 23:35:00 | test badminton | Type: badminton (typeId: 224, parentTypeId: 219)
(Dry run) would have set activity type to cycling (typeId: 2, parentTypeId: 17)
We can take this information to figure out what command line you would need to use:
python3 gc-activity-type.py --help
usage: gc-activity-type.py [-h] [--version] [--username [USERNAME]] [--password [PASSWORD]]
[--startdate [STARTDATE]]
[--enddate [ENDDATE]]
[--privacy [PRIVACY]]
[--activity-type ACTIVITY_TYPE] [--activity-type-id ACTIVITY_TYPE_ID]
[--activity-parent-type-id ACTIVITY_PARENT_TYPE_ID] [--match-activity-type MATCH_ACTIVITY_TYPE]
[--match-activity-type-id MATCH_ACTIVITY_TYPE_ID]
[--match-activity-parent-type-id MATCH_ACTIVITY_PARENT_TYPE_ID] [--dry-run]
Wow, thanks for your quick and very detailed reply! I am away from my laptop for a couple for days now, but will try again when I get back home.
My issue as that I could simply not start the script from a command prompt - using the "python3" command simply brought up errors, no matter how I tried it. I could only start the script by diuble-clicking it, so I could never use the help or dryrun feature :-(
Dear Will, I played around with it some more, and finally managed to get it running via command prompt. After disabling two-factor-authorization on my account (maybe a useful tip for others out there - took me a while to figure that one out), your script worked like a charm.
Thank you so much for looking up the IDs and letting me know the exact prompt. I really appreciate it!
It still works great, thank you
My username is just my e-mail adress, right?
Yeah.
I never seem to be able to put in my password
While you're entering your password, there'll be no indication that anything is typed (asterisks won't be displayed). Sorry, that's the behavior of the standard python "password input" function. Just type your password in as you normally would, and press Enter/Return.
Thanks for the very quick answer! Still get the same error message, tho:
Searching for activities (this might take a while)...
Traceback (most recent call last):
File "C:\Users\visse\OneDrive\06 - Overige\01 - Downloads privé\gc-activity-type.py", line 324, in <module>
ACTIVITY_LIST = http_req(ACLISTURL, None, {
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\visse\OneDrive\06 - Overige\01 - Downloads privé\gc-activity-type.py", line 115, in http_req
response = OPENER.open((request), data=post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\visse\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\visse\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "C:\Users\visse\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\visse\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Users\visse\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
Do you have 2FA enabled?