From: <jb...@us...> - 2009-09-23 12:06:55
|
Revision: 357 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=357&view=rev Author: jblance Date: 2009-09-23 12:06:44 +0000 (Wed, 23 Sep 2009) Log Message: ----------- Fixing up a messy plugin commit Added Paths: ----------- pytrainer/trunk/plugins/googleearth/main.sh Removed Paths: ------------- pytrainer/trunk/plugins/googleearth/garmin-tcxv2.py pytrainer/trunk/plugins/googleearth/garmin-tcxv2.pyc pytrainer/trunk/plugins/googleearth/translate.xsl Deleted: pytrainer/trunk/plugins/googleearth/garmin-tcxv2.py =================================================================== --- pytrainer/trunk/plugins/googleearth/garmin-tcxv2.py 2009-09-23 11:36:05 UTC (rev 356) +++ pytrainer/trunk/plugins/googleearth/garmin-tcxv2.py 2009-09-23 12:06:44 UTC (rev 357) @@ -1,57 +0,0 @@ -# -*- coding: iso-8859-1 -*- - -#Copyright (C) Fiz Vazquez vu...@si... -# Modified by dgranda - -#This program is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public License -#as published by the Free Software Foundation; either version 2 -#of the License, or (at your option) any later version. - -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. - -#You should have received a copy of the GNU General Public License -#along with this program; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -import logging -import os -import libxml2 -import libxslt - -class garminTCXv2(): - def __init__(self, parent = None): - self.parent = parent - self.tmpdir = self.parent.conf.getValue("tmpdir") - - def run(self): - logging.debug(">>") - # able to select multiple files.... - f = os.popen("zenity --file-selection --multiple --title 'Choose a TCX file to import'") - inputData = f.read().strip() - inputfiles = inputData.split('|') - xslfile= os.path.dirname(os.path.realpath(__file__)) + "/translate.xsl" - outputfile=[] - if os.path.isfile(xslfile): - for index in range(len(inputfiles)): - outputfile.append(self.tmpdir+"/outputfile"+str(index)+".gpx") - inputfile=inputfiles[index] - if os.path.isfile(inputfile): - styledoc = libxml2.parseFile(xslfile) - style = libxslt.parseStylesheetDoc(styledoc) - doc = libxml2.parseFile(inputfile) - result = style.applyStylesheet(doc, None) - style.saveResultToFilename(outputfile[index], result, 0) - style.freeStylesheet() - doc.freeDoc() - result.freeDoc() - else: - raise Exception("XML input file not found, looking for: " + inputfile) - else: - raise Exception("XSL file not found, looking for: " + xslfile) - logging.debug("<<") - return outputfile - Deleted: pytrainer/trunk/plugins/googleearth/garmin-tcxv2.pyc =================================================================== (Binary files differ) Added: pytrainer/trunk/plugins/googleearth/main.sh =================================================================== --- pytrainer/trunk/plugins/googleearth/main.sh (rev 0) +++ pytrainer/trunk/plugins/googleearth/main.sh 2009-09-23 12:06:44 UTC (rev 357) @@ -0,0 +1,26 @@ +#!/bin/sh +# -*- coding: iso-8859-1 -*- + +#Copyright (C) Fiz Vazquez vu...@si... + +#This program is free software; you can redistribute it and/or +#modify it under the terms of the GNU General Public License +#as published by the Free Software Foundation; either version 2 +#of the License, or (at your option) any later version. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +var=`zenity --file-selection` + +tmpgpx="/tmp/reg.gpx" +gpsbabel -t -i kml -f $var -o gpx -F $tmpgpx + +echo $tmpgpx Property changes on: pytrainer/trunk/plugins/googleearth/main.sh ___________________________________________________________________ Added: svn:executable + * Deleted: pytrainer/trunk/plugins/googleearth/translate.xsl =================================================================== --- pytrainer/trunk/plugins/googleearth/translate.xsl 2009-09-23 11:36:05 UTC (rev 356) +++ pytrainer/trunk/plugins/googleearth/translate.xsl 2009-09-23 12:06:44 UTC (rev 357) @@ -1,63 +0,0 @@ -<?xml version="1.0"?> - -<!-- note defining a namespace for TrainingCenterDatabase as the translation does not seem to work with a default namespace --> -<xsl:stylesheet version="1.0" -xmlns:t="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" -xmlns:xsl="http://www.w3.org/1999/XSL/Transform" -> -<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/> - -<!-- this is a bit of a messy way to get whitespace into the output - but it works --> -<xsl:variable name="newline"><xsl:text> -</xsl:text></xsl:variable> - -<xsl:template match="/"> - <gpx xmlns="http://www.topografix.com/GPX/1/1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0" - creator="pytrainer http://sourceforge.net/projects/pytrainer" version="1.1" - xsi:schemaLocation="http://www.topografix.com/GPX/1/1 - http://www.topografix.com/GPX/1/1/gpx.xsd - http://www.cluetrust.com/XML/GPXDATA/1/0 - http://www.cluetrust.com/Schemas/gpxdata10.xsd"> - - <xsl:value-of select="$newline"/> - <xsl:variable name="sport"><xsl:value-of select="t:TrainingCenterDatabase/t:Activities/t:Activity/@Sport"/></xsl:variable> - <xsl:variable name="time"><xsl:value-of select="t:TrainingCenterDatabase/t:Activities/t:Activity/t:Id"/></xsl:variable> - <xsl:variable name="name"><xsl:value-of select="$sport"/><xsl:value-of select="substring($time, 1,10)"/></xsl:variable> - <metadata><xsl:value-of select="$newline"/> - <name><xsl:value-of select="$name"/></name><xsl:value-of select="$newline"/> - <link href="http://sourceforge.net/projects/pytrainer"/><xsl:value-of select="$newline"/> - <time><xsl:value-of select="$time"/></time><xsl:value-of select="$newline"/> - </metadata><xsl:value-of select="$newline"/> - <trk><xsl:value-of select="$newline"/> - <xsl:for-each select="t:TrainingCenterDatabase/t:Activities/t:Activity/t:Lap"> - <trkseg><xsl:value-of select="$newline"/> - <xsl:variable name="calories"><xsl:value-of select="t:Calories"/></xsl:variable> - <xsl:for-each select="t:Track/t:Trackpoint"> - <!-- only output a trkpt if a position exists --> - <xsl:if test="t:Position"> - <xsl:variable name="lat"><xsl:value-of select="t:Position/t:LatitudeDegrees"/></xsl:variable> - <xsl:variable name="lon"><xsl:value-of select="t:Position/t:LongitudeDegrees"/></xsl:variable> - <trkpt lat="{$lat}" lon="{$lon}"><xsl:value-of select="$newline"/> - <ele><xsl:value-of select="t:AltitudeMeters"/></ele><xsl:value-of select="$newline"/> - <time><xsl:value-of select="t:Time"/></time><xsl:value-of select="$newline"/> - <xsl:if test="t:HeartRateBpm/t:Value"> - <extensions><xsl:value-of select="$newline"/> - <gpxdata:hr><xsl:value-of select="t:HeartRateBpm/t:Value"/></gpxdata:hr><xsl:value-of select="$newline"/> - </extensions><xsl:value-of select="$newline"/> - </xsl:if> - </trkpt><xsl:value-of select="$newline"/> - </xsl:if> - </xsl:for-each> - <xsl:value-of select="$newline"/> - <extensions><xsl:value-of select="$newline"/> - <gpxdata:sportType><xsl:value-of select="$sport"/></gpxdata:sportType><xsl:value-of select="$newline"/> - <gpxdata:calories><xsl:value-of select="$calories"/></gpxdata:calories><xsl:value-of select="$newline"/> - </extensions><xsl:value-of select="$newline"/> - </trkseg><xsl:value-of select="$newline"/> - </xsl:for-each> - </trk><xsl:value-of select="$newline"/> - </gpx><xsl:value-of select="$newline"/> -</xsl:template> -</xsl:stylesheet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |