Golden Cheetah & Garmin Connect - "Download, archive, cloud-backup and auto-import your activities."
You are a runner, cyclist or triathlete? You love Golden Cheetah? You track your activities with Garmin devices? You want to download all of them from Garmin Connect? You want to archive, cloud-backup and import automatically into Golden Cheetah? Alright, where´s the problem?!? Rise a feature request and ask for new Golden Cheetah functionality! But exactly this is easier said than done:
1) Garmin charges an expensive one-time administrative fee to cover their extensive engineering and server support they require for running the Connect program. 2) Golden Cheetah is an open source application and there might be no chance of any payment to Garmin for its use at all. 3) As Garmin does also not offer alternatives the chances for a new Golden Cheetah feature are really low.
But there are tons of alternatives and workarounds. Here is mine.
Download, archive, backup, auto-import!
Apple claims writing a shell script is like riding a bike: "You fall off and scrape your knees a lot at first. With a bit more experience, you become comfortable riding them around..." Awesome! For the rest I totally agree. "Shell scripting is perfect for creating small pieces of code that connect other tools together."
Before we are diving into details some insights on my tooling: Mac user, running their latest OSX. Additional to that my preferred cloud storage is Google Drive. The latter would not make any difference to a Dropbox, Box.com or another typical cloud storage.
What else you need
- Golden Cheetah: http://goldencheetah.org/
- Download script for Garmin Connect data: https://github.com/moderation/garmin-connect-export
- Python: https://www.python.org/downloads/
- My shell script: Download my sport.sh file
Follow these steps for the initial configuration.
If you decide to create these folders in your preferred cloud storage, for example a Google Drive, they get synced automatically in the background from your local client to your cloud storage.
- One folder for your backups:
- Another one for your Golden Cheetah Athletes Library: ~/Documents/GoldenCheetah/AthleteLibrary/Johannes/
- And another one for your exports from Garmin Connect to auto-import them to Golden Cheetah:
Configuring our awesome performance software step by step.
- Unzip and install Golden Cheetah.
- Open it.
- Create a new athlete.
- Change Golden Cheetahs athletes directory to the folder you just created:
Open Preference > General > there it is. Save it.
- Close GoldenCheetah.
- Open it again.
- If you have to create your athlete again. Do it. It will re-create all subfolders in the new athlete directory.
- Configure your auto import folder:
Go to Preference > General > Tab: auto imports. Save it.
- That´s it for Golden Cheetah. Close it.
My .sh script
If it did not yet happen. Download my shell script to adjust it according your needs.
- Set your Garmin Connect username:
- Set your Garmin Connect password:
- Set your number of past activities to export from Garmin Connect:
- Reference to your GoldenCheetah backup folder:
- Reference to your Athletelibrary folder:
- Reference to your Garmin Connect export script folder:
- Reference to your Garmin Connect export folder:
Disclaimer Security Information
The way as the shell script is described has litte to no change of running securely. Passwords are stored plain in the script itself. It definitely has a lot of room for improvements. My intention is to keep it as simple and pragmatic for you. That is the basis to adjust it according your personal paranoia level. The most secure way would be to type it in every time you run the script.
What the rest does
The following section explains in detail what the rest of the script does. But first: You don´t have to adjust anything else there. Everything got already configured with setting the parameters.
- Grabs Date und Year:
- Zips your athlete directory and keeps a history for the last 5 backups:
cd $mybackupfolderls -dt *.zip | tail -n +5 | xargs rm -rfzip -r -9 -o $mybackupfolder/"$todaysdate".zip $myathletelibraryfolder
- Yearly archive for exported Garmin Connect activities:
mv $mygarminconnectexportsfolder/*.fit $mygarminconnectexportsfolder/$todaysyear/
- Exports activities from Garmin Connect
python $mygarminconnectexportscriptfolder/gcexport.py -d $mygarminconnectexportsfolder -c "$mynumberofexports" -f original -u --username "$mygarminusername" --password "$mygarminpassword"
Hint: The script calls Garmins activity-search-service endpoint. If the Activity Search Service responds by accident with an error 500 the amount of data for one single call seems to be to much. Reducing &mynumberofexports to 10 or 20 shall hopefully solve it. If it is still not possible to download data you need to create a ticket asking Garmins support crew to check if your account is allowed and not blocked using these endpoints.
- Opens GoldenCheetah
open -a GoldenCheetah
Running the script is easy. There are various ways. Very old school with a simple terminal command: "sh sport.sh". Or make sure that Python is installed and just double-click your *.sh.
How to recover a backup
The most important folder is your athlete directory. Everything in there gets "backuped" and can easily get recovered with overwriting a newly created athlete:
- Download, unzip, install and open GoldenCheetah.
- Create a new athlete.
- Change athlete directory.
- Close GoldenCheetah.
- Open GoldenCheetah again. Just to be on the safe side.
- Unzip latest ZIP from your backups.
- Replace new athlete folder with your Backup.
- Open Golden Cheetah.
- Backup recovered.