sqlite
All things related to IT security, privacy and compliance.
Don’t forget to check out #InfoSecAndCompliance on Jaiku.
Some python code for extracting OS X Garmin Training Center data
If you’ve got python and it’s sqlite library installed, then this script will be a half-decent example of how to pull data from “.gtc” database for each entry in the stored history. If not, have no fear, I hope to release a small app to let you extract the data on your own and I’m still thinking about that widget.
Pretty source after the jump.
Open in new window
Garmin Training Center for OS X Data File Format
My interest in learning the secrets of the Garmin Training Center for OS X user data file was renewed upon learning that the author of TrailRunner added the ability to import GTC data directly into that app. After a cursory search for clues on the format of the “Training Center.gtc” data file, I managed to find the needed bit of knowledge after digging through one of the forums over at MotionBased. One of the posters - saeedi - suggested it was a sqlite database. After making a copy of the file, I opened it up with sqlite3, tried a “.schema” command and was greeted with the following:
CREATE TABLE ZCDABSTRACTSTEP ( Z_ENT INTEGER, Z_PK INTEGER PRIMARY KEY, Z_OPT INTEGER, ZORDER INTEGER, ZBELONGSTOPLAN INTEGER, ZISCHILDOF INTEGER, ZITERATIONS INTEGER, ZNAME VARCHAR, ZISRESTING INTEGER, ZCOMPLETIONCRITERIA INTEGER, Z5_COMPLETIONCRITERIA INTEGER, ZPERFORMANCEZONE INTEGER, Z12_PERFORMANCEZONE INTEGER );
CREATE TABLE ZCDACTIVITYPROFILE ( Z_ENT INTEGER, Z_PK INTEGER PRIMARY KEY, Z_OPT INTEGER, ZMAXHEARTRATE INTEGER, ZNAME VARCHAR, ZGEARWEIGHT FLOAT, ZACTIVITYTYPE INTEGER, ZDEVICE INTEGER );
CREATE TABLE ZCDCOMPLETIONCRITERIA ( Z_ENT INTEGER, Z_PK INTEGER PRIMARY KEY, Z_OPT INTEGER, ZBELONGSTOLEAFSTEP INTEGER, ZTARGETCALORIES INTEGER, ZTARGETDISTANCE INTEGER, ZLIMIT INTEGER, ZLIMITTYPE INTEGER, ZTARGETTIME INTEGER );
CREATE TABLE ZCDDEVICE ( Z_ENT INTEGER, Z_PK INTEGER PRIMARY KEY, Z_OPT INTEGER, ZID INTEGER, ZMAXSCHEDULEDPLANS INTEGER, ZMAXCOURSETRACKPOINTS INTEGER, ZMAXCOURSEPOINTS INTEGER, ZMAXSCHEDULEDPLANDATES INTEGER, ZPRODUCTNAME VARCHAR, ZMAXCOURSELAPS INTEGER, ZMAXUNSCHEDULEDPLANS INTEGER, ZNAME VARCHAR, ZMAXCOURSES INTEGER, ZPRODUCTID INTEGER, ZSOFTWAREVERSION INTEGER, ZOWNER INTEGER );
…(trimmed)…
It certainly looks like it’s a sqlite database. Just to verify, I tried a few SQL commands:
sqlite> select zproductname from zcddevice ;
ZPRODUCTNAME
--------------------
EDGE305
Forerunner305
sqlite>.output gtc-tree.html
sqlite>select * from zcdtreeitem
While not the prettiest schema, it’s workable. Once I get more time to dissect it a bit, I’ll post some code to extract runs/routes and maybe even take a shot at a widget.
Technorati Tags: 


Recent Comments
2 days 5 hours ago
5 days 6 hours ago
7 weeks 1 day ago
15 weeks 23 hours ago
15 weeks 2 days ago
16 weeks 1 day ago
17 weeks 3 days ago
18 weeks 10 hours ago
28 weeks 4 days ago
28 weeks 4 days ago