2014-11-11 13:48:28 +01:00
Garmin Connect activity exporter
================================
2014-11-11 13:46:14 +01:00
``garminexport.py`` is a program that downloads *all*
2014-11-11 13:45:11 +01:00
activities for a given [Garmin Connect ](http://connect.garmin.com/ )
2014-11-11 13:48:28 +01:00
account and stores them in a backup directory locally on the user's
computer.
2014-11-11 13:45:11 +01:00
2014-11-11 13:48:28 +01:00
The ``incremental_backup.py`` program can be used for incremental backups
of your account. This script only downloads
2014-11-11 13:45:11 +01:00
activities that haven't already been downloaded to a certain backup directory.
It is typically a quicker alternative (except for the first time when all
activities will need to be downloaded).
2014-11-08 13:11:01 +01:00
2014-11-08 13:35:47 +01:00
Prerequisites
=============
The instructions below for running the program (or importing the module)
assumes that you have [Python 2.7 ](https://www.python.org/download/releases/2.7/ ),
[pip ](http://pip.readthedocs.org/en/latest/installing.html ), and [virtualenv ](http://virtualenv.readthedocs.org/en/latest/virtualenv.html#installation ) installed.
It also assumes that you have registered an account at
2014-11-08 13:41:13 +01:00
[Garmin Connect ](http://connect.garmin.com/ ).
2014-11-08 13:35:47 +01:00
2014-11-11 13:45:11 +01:00
2014-11-08 13:35:47 +01:00
Getting started
===============
Create and activate a new virtual environment to create an isolated development
environment (that contains the required dependencies and nothing else).
2014-11-08 13:41:13 +01:00
virtualenv venv.garminexport
. venv.garminexport/bin/activate
2014-11-08 13:35:47 +01:00
Install the required dependencies in this virtual environment:
2014-11-08 13:41:13 +01:00
pip install -r requirements.txt
2014-11-08 13:35:47 +01:00
2014-11-11 13:45:11 +01:00
Running the export program
==========================
The export program is run as follows (use the ``--help`` flag for a list of
2014-11-08 13:35:47 +01:00
available options).
2014-11-08 13:41:13 +01:00
./garminexport.py < username or email >
2014-11-08 13:35:47 +01:00
Once started, the program will prompt you for your account password and then
2014-11-11 13:45:11 +01:00
log in to your Garmin Connect account to download *all* activities to a
destination directory on your machine.
2014-11-08 13:35:47 +01:00
2014-11-09 13:32:20 +01:00
For each activity, these files are stored:
2014-11-09 13:56:50 +01:00
- an activity summary file (JSON)
2014-11-09 13:32:20 +01:00
2014-11-09 13:56:50 +01:00
- an activity details file (JSON)
2014-11-09 13:32:20 +01:00
2014-11-09 13:56:50 +01:00
- an activity GPX file (XML)
2014-11-09 13:32:20 +01:00
2014-11-09 13:56:50 +01:00
- an activity TCX file (XML)
2014-11-09 13:32:20 +01:00
2014-11-09 13:56:50 +01:00
- an activity FIT file (binary) (if available -- the activity may have
2014-11-09 13:57:50 +01:00
been entered manually rather than imported from a Garmin device).
2014-11-09 13:32:20 +01:00
2014-11-11 12:42:05 +01:00
All files are written to the same directory (``activities/`` by default).
Each activity file is prefixed by its upload timestamp and its
2014-11-09 13:32:20 +01:00
activity id.
2014-11-08 13:35:47 +01:00
2014-11-11 13:45:11 +01:00
Running the incremental backup program
======================================
The incremental backup program is run in a similar fashion to the export
program (use the ``--help`` flag for a list of available options):
./incremental_backup.py --backup-dir=activities < username or email >
In this example, it will only download activities that aren't already in
the ``activities/`` directory. Note: The incremental backup program saves
the same files for each activity as the export program (see above).
2014-11-08 13:35:47 +01:00
Library import
==============
To install the development version of this library in your local Python
environment, run:
`pip install -e git://github.com/petergardfjall/garminexport.git#egg=garminexport`
or if you prefer to use a `requirements.txt` file, add the following line
to your list of dependencies:
`-e -e git://github.com/petergardfjall/garminexport.git#egg=garminexport`
and run pip with you dependency file as input:
`pip install -r requirements.txt`