aboutsummaryrefslogtreecommitdiff
path: root/mapsparsing.py
diff options
context:
space:
mode:
authorLionel <lionel.miquel46@gmail.com>2018-10-16 23:09:26 +0200
committerLionel <lionel.miquel46@gmail.com>2018-10-16 23:09:26 +0200
commit480a2935e0eba6fe2577b10f317f2fdbea55d7ce (patch)
tree5058e857a3027cb0912c03a9aa99b1881ee11d5b /mapsparsing.py
parent32aa9e84ee635b37f4cff37112e3e62837c914f4 (diff)
downloadrandopitons-480a2935e0eba6fe2577b10f317f2fdbea55d7ce.tar.gz
randopitons-480a2935e0eba6fe2577b10f317f2fdbea55d7ce.zip
presque fini wlh
Diffstat (limited to 'mapsparsing.py')
-rw-r--r--mapsparsing.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/mapsparsing.py b/mapsparsing.py
index 7fb6edd..7128f62 100644
--- a/mapsparsing.py
+++ b/mapsparsing.py
@@ -2,27 +2,27 @@ import xml.etree.ElementTree as xmlp
import re
import errmsg as e
-def mapparsing(filetype,basicfilename):
+def mapparsing(maptype,basicfilename):
try:
root=tree.getroot()
- if filetype==1:
+ if maptype==1:
tree=xmlp.parse(basicfilename)
filename=root[1][0].text+".gpx"
- else filetype==2:
- tree=xmlp.parse(basicfilename)
- filename= root[0][10][1][0].text+".kml"
- elif filetype==3:
+ elif maptype==2:
thefile=open(basicfilename)
for i in range(3):
thefile.readline()
- filename=re.findall(r'\|(.*?)\|', thefile.readline())[0]
+ filename=re.findall(r'\|(.*?)\|', thefile.readline())[0]+".trk"
+ elif maptype==3:
+ tree=xmlp.parse(basicfilename)
+ filename= root[0][10][1][0].text+".kml"
os.rename(basicfilename,filename)
except OSError, e:
print e.os
- except xml.etree.ElementTree.ParseError, e:
+ except xmlp.ParseError, e:
print e.formaterr
print format(e)
os.remove(basicfilename)
pass
- return filename
+ return filename