I like to keep the data around from my Swimmovate PoolMate and entering the details into TrainingPeaks is very cumbersome. So I wrote a quick script to generate TCX files that can be uploaded. Its very simple:
#!/bin/bash
function do_lap() {
LAP_TIME=`expr $LAP_MINUTES \* 60`
LAP_TIME=`expr $LAP_TIME + $LAP_SECONDS`
echo " <Lap StartTime=\"$LAP_START\">" >> $START_DATE.tcx
echo " <TotalTimeSeconds>$LAP_TIME</TotalTimeSeconds>" >> $START_DATE.tcx
echo " <DistanceMeters>$LAP_DISTANCE</DistanceMeters>" >> $START_DATE.tcx
echo " <Intensity>$1</Intensity>" >> $START_DATE.tcx
echo " <TriggerMethod>Manual</TriggerMethod>" >> $START_DATE.tcx
echo " </Lap>" >> $START_DATE.tcx
MINUTE_OFFSET=`expr $MINUTE_OFFSET + $LAP_MINUTES`
SECOND_OFFSET=`expr $SECOND_OFFSET + $LAP_SECONDS`
}
START_DATE=`date +%Y-%m-%dT%H:%M:%S.000Z`
cat header.tcx > $START_DATE.tcx
echo " <Id>"$START_DATE"</Id>" >> $START_DATE.tcx
echo -n "Yards or Meters (y/m): "
read YARDS
echo -n "Number of sets: "
read SETS
CURRENT_SET=0
MINUTE_OFFSET=0
SECOND_OFFSET=0
while [ $CURRENT_SET -ne $SETS ]; do
echo -n "Set $CURRENT_SET Distance: "
read LAP_DISTANCE
if [ "$YARDS" = "y" ]; then
LAP_DISTANCE=`echo $LAP_DISTANCE \* 0.9144 | bc`
fi
echo -n "Set $CURRENT_SET Time (Min Sec): "
read LAP_MINUTES LAP_SECONDS
LAP_START=`date -v +${MINUTE_OFFSET}M -v +${SECOND_OFFSET}S +%Y-%m-%dT%H:%M:%S.000Z`
do_lap "Active"
#Default to 60 second reset between sets
LAP_MINUTES=0
LAP_SECONDS=60
LAP_DISTANCE=0
do_lap "Resting"
CURRENT_SET=`expr $CURRENT_SET + 1`
done
cat trailer.tcx >> $START_DATE.tcx
Here is header.tcx
<?xml version="1.0" encoding="UTF-8"?>
<TrainingCenterDatabase
xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd"
xmlns:ns5="http://www.garmin.com/xmlschemas/ActivityGoals/v1"
xmlns:ns3="http://www.garmin.com/xmlschemas/ActivityExtension/v2"
xmlns:ns2="http://www.garmin.com/xmlschemas/UserProfile/v2"
xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.garmin.com/xmlschemas/ProfileExtension/v1">
<Activities>
<Activity Sport="Other">
And trailer.tcx
</Activity>
</Activities>
</TrainingCenterDatabase>
<< Home