Multiple '_' fix.
authorRoman Bazalevskiy <rvb@rvb.name>
Tue, 4 May 2021 11:20:55 +0000 (14:20 +0300)
committerRoman Bazalevskiy <rvb@rvb.name>
Tue, 4 May 2021 11:20:55 +0000 (14:20 +0300)
pyrungps/pyrungps_sync.py

index b87a17e4c20b3a71dfb91da3faa68a5d7ecfe26f..420994b8d54f6054e718babc3e40dcb6c0692790 100644 (file)
@@ -14,15 +14,15 @@ from optparse import OptionParser
 from datetime import date,datetime
 from dateutil.parser import isoparse
 from pyrungps.parsegpx import write_parsed_to_db,check_db_for_training
 from datetime import date,datetime
 from dateutil.parser import isoparse
 from pyrungps.parsegpx import write_parsed_to_db,check_db_for_training
-import pyrungps.pygpx
+from pyrungps.pygpx import GPX
 
 from tempfile import NamedTemporaryFile
 
 from pprint import pprint
 
 
 from tempfile import NamedTemporaryFile
 
 from pprint import pprint
 
-import pyrungps.render_tiles
+from pyrungps.render_tiles import queue_render
 
 
-import pyrungps.generate_image
+from pyrungps.generate_image import render_all
 
 def get_page(uname,year,month):
   
 
 def get_page(uname,year,month):
   
@@ -36,7 +36,7 @@ def get_page(uname,year,month):
     if attribute == "href":
       if link.startswith("/trainings/"):
         dummy, dummy, link = link.split('/')
     if attribute == "href":
       if link.startswith("/trainings/"):
         dummy, dummy, link = link.split('/')
-        name, id = link.split('_')
+        name, id, *_ = link.split('_')
         trainings.append([ unquote(name), id ])
       
   return trainings      
         trainings.append([ unquote(name), id ])
       
   return trainings      
@@ -181,7 +181,7 @@ def sync_db(dbx,username,year,month,dir=".",verbose=False,force=False):
         if verbose:
           print("writing training %s" % (filename))
 
         if verbose:
           print("writing training %s" % (filename))
 
-        gpx = pygpx.GPX()
+        gpx = GPX()
         gpx.ReadTree(xml)
 
         sport = training['sport']
         gpx.ReadTree(xml)
 
         sport = training['sport']
@@ -205,7 +205,7 @@ def sync_db(dbx,username,year,month,dir=".",verbose=False,force=False):
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
-          render_tiles.queue_render(db,filename)
+          queue_render(db,filename)
         except:
           None  
 
         except:
           None  
 
@@ -236,7 +236,7 @@ def sync_osm(username,password,year,month,dir=".",verbose=False,force=False):
         if verbose:
           print("writing training %s" % (filename))
 
         if verbose:
           print("writing training %s" % (filename))
 
-        gpx = pygpx.GPX()
+        gpx = GPX()
         gpx.ReadTree(xml)
 
         sport = training['sport']
         gpx.ReadTree(xml)
 
         sport = training['sport']
@@ -258,7 +258,7 @@ def sync_osm(username,password,year,month,dir=".",verbose=False,force=False):
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
-          render_tiles.queue_render(db,filename)
+          queue_render(db,filename)
         except:
           None  
 
         except:
           None  
 
@@ -288,7 +288,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False):
         if verbose:
           print("writing training %s" % (filename))
 
         if verbose:
           print("writing training %s" % (filename))
 
-        gpx = pygpx.GPX()
+        gpx = GPX()
         gpx.ReadTree(xml)
 
         sport = tr[0]
         gpx.ReadTree(xml)
 
         sport = tr[0]
@@ -307,7 +307,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False):
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
         f.close
         write_parsed_to_db(db,gpx,filename)
         try:
-          render_tiles.queue_render(db,filename)
+          queue_render(db,filename)
         except:
           None  
 
         except:
           None  
 
@@ -408,7 +408,7 @@ def main():
       elif dbauth:
         sync_db(dbx,pusername,current_year,current_month,outdir,options.verbose,options.force)  
 
       elif dbauth:
         sync_db(dbx,pusername,current_year,current_month,outdir,options.verbose,options.force)  
 
-    generate_image.render_all(db,'/etc/mapnik-osm-carto-data/veloroad-imposm.xml',640,640)
+    render_all(db,'/etc/mapnik-osm-carto-data/veloroad-imposm.xml',640,640)
 
 if __name__ == "__main__":
 
 
 if __name__ == "__main__":