From: <dg...@us...> - 2010-01-14 21:41:32
|
Revision: 474 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=474&view=rev Author: dgranda Date: 2010-01-14 21:41:25 +0000 (Thu, 14 Jan 2010) Log Message: ----------- Calories data within lap information, not within trackpoints. Check other plugins than garmintools Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/gpx.py Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2010-01-08 18:58:09 UTC (rev 473) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2010-01-14 21:41:25 UTC (rev 474) @@ -146,7 +146,7 @@ #print elapsedTime calories = lap.findtext(calorieTag) distance = lap.findtext(distanceTag) - #print "Found time: %s, lat: %s lon: %s cal: %s dist: %s " % (elapsedTime, lat, lon, calories, distance) + logging.debug("Found time: %s, lat: %s lon: %s cal: %s dist: %s " % (elapsedTime, lat, lon, calories, distance)) lapInfo.append((elapsedTime, lat, lon, calories, distance)) return lapInfo @@ -154,18 +154,17 @@ ''' Migrated to eTree XML processing 26 Nov 2009 - jblance ''' - logging.debug(">>") tree = self.tree - - trkpoints = tree.findall(trackPointTag) - #start with the info at trkseg level - #calories - maybe more than one, currently adding them together - trks = tree.findall(trackTag) - for trk in trks: - calorieCollection = trk.findall(calorieTag) - for cal in calorieCollection: - self.calories += int(cal.text) + + # Calories data comes within laps. Maybe more than one, adding them together - dgranda 20100114 + laps = tree.findall(lapTag) + for lap in laps: + lapCalories = lap.findtext(calorieTag) + logging.debug("Lap calories: "+str(lapCalories)) + self.calories += int(lapCalories) + logging.debug("Calories: "+str(self.calories)) + retorno = [] his_vel = [] last_lat = "False" @@ -176,6 +175,7 @@ tmp_alt = 0 len_validhrpoints = 0 + trkpoints = tree.findall(trackPointTag) if not len(trkpoints): return retorno This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |