aboutsummaryrefslogtreecommitdiff
path: root/mapsparsing.py
diff options
context:
space:
mode:
authorLionel <lionel.miquel46@gmail.com>2018-10-04 08:13:08 +0200
committerLionel <lionel.miquel46@gmail.com>2018-10-04 08:13:08 +0200
commit8fd35574400834517db2a51e92eba970f614843e (patch)
treeefc032a6f130e80b0422159724654fadce6e99ce /mapsparsing.py
parent0943dd142523b53e3748987fd16c77e6567c2fab (diff)
downloadrandopitons-8fd35574400834517db2a51e92eba970f614843e.tar.gz
randopitons-8fd35574400834517db2a51e92eba970f614843e.zip
On a encore plus nettoyé tout ce bazard, on va maintenant améliorer le sctrip
t pour le parsing des fichiers
Diffstat (limited to 'mapsparsing.py')
-rw-r--r--mapsparsing.py48
1 files changed, 18 insertions, 30 deletions
diff --git a/mapsparsing.py b/mapsparsing.py
index 4fc1cc5..c0fcc91 100644
--- a/mapsparsing.py
+++ b/mapsparsing.py
@@ -1,45 +1,33 @@
import xml.etree.ElementTree as xmlp
import re
-def gpxparsing():
+
+def mapparsing(filetype,basicfilename):
try:
- tree=xmlp.parse('f.gpx')
+ tree=xmlp.parse(basicfilename)
root=tree.getroot()
+
filename=root[1][0].text+".gpx"
- os.rename('f.gpx',filename)
+
+
+ os.rename(basicfilename,filename)
except OSError, e:
print("Operating System error: {0}".format(e))
except xml.etree.ElementTree.ParseError,e:
print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
- os.remove('f.gpx')
+ os.remove(basicfilename)
pass
return filename
-
-
-def kmlparsing():
-
- try:
- tree=xmlp.parse('f.kml')
- root=tree.getroot()
+
+ #kml
filename= root[0][10][1][0].text+".kml"
- except OSError, e:
- print("Operating System error: {0}".format(e))
- except xml.etree.ElementTree.ParseError,e:
- print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
- os.remove('f.kml')
- pass
- return filename
-def trkparsing():
- try:
- tree=xmlp.parse('f.gpx')
- root=tree.getroot()
+ #gpx
filename=root[1][0].text+".gpx"
- os.rename('f.gpx',filename)
- except OSError, e:
- print("Operating System error: {0}".format(e))
- except xml.etree.ElementTree.ParseError,e:
- print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
- os.remove('f.gpx')
- pass
- return filename
+
+ #trk
+ thefile=open("f.trk")
+ for i in range(3):
+ thefile.readline()
+ name=thefile.readline()
+ re.findall(r'\|(.*?)\|', filename)