As gpsbabel doesn’t do ‘calories’ from garmin data (and why should it?), I’ve been making a mental note of the calories for use in pytrainer (or, when I forget, checking the device history!). I wasn’t aware of garmin_tools until just recently, discovered ploughing through the Ubuntu repository after a lovely upgrade to Karmic Koala. The package is a set of tools to dump data from the device and then convert the data to other known formats, like GPX or Google map data. It is not as detailed as the kml produced by gpsbabel but it does contain the missing information — like the calories — needed to ‘complete’ a run in kml; if only there were a script to pull the useful bits out
#!/bin/sh me=${0##*/} tools=`which garmin_get_info` if [ -z $tools ]; then echo "$me: Are garmin_tools installed (can't find garmin_get_info)?" exit 1 fi # see garmin_save_runs man page about GAMIN_SAVE_RUNS GARMIN_SAVE_RUNS=/tmp export GARMIN_SAVE_RUNS result=`garmin_save_runs | grep -c "garmin unit could not be opened!"` if [ ${result} -eq 0 ]; then y=`date +%Y` m=`date +%m` d=`date +%d` garmin_dump $GARMIN_SAVE_RUNS/$y/$m/$y$m$d*.gmn | grep calories else echo "$me: couldn't connect to garmin unit; is it plugged in?" exit 1 fi exit 0There. This writes a stanza to stdout containing the calories for any of today’s tracks. Works OK, xml can go straight in to the kml used by kmlextract or something. It’s a prototype used to figure out what I can do next, like ’start’ and ‘finish’ graphics in the kml. That’s also one less manual process I need to think about therefore easing pressure on my brain
(which I’m sure is a tip I’ve covered before, pulled straight from the Pragmatic Programmer)
No comments:
Post a Comment