From c32d93499f49adca306a944519a26dfc62cd3d94 Mon Sep 17 00:00:00 2001 From: Roman Bazalevskiy Date: Tue, 4 May 2021 14:20:55 +0300 Subject: [PATCH 1/1] Multiple '_' fix. --- pyrungps/pyrungps_sync.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pyrungps/pyrungps_sync.py b/pyrungps/pyrungps_sync.py index b87a17e..420994b 100644 --- a/pyrungps/pyrungps_sync.py +++ b/pyrungps/pyrungps_sync.py @@ -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 -import pyrungps.pygpx +from pyrungps.pygpx import GPX 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): @@ -36,7 +36,7 @@ def get_page(uname,year,month): 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 @@ -181,7 +181,7 @@ def sync_db(dbx,username,year,month,dir=".",verbose=False,force=False): if verbose: print("writing training %s" % (filename)) - gpx = pygpx.GPX() + gpx = GPX() 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: - render_tiles.queue_render(db,filename) + queue_render(db,filename) 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)) - gpx = pygpx.GPX() + gpx = GPX() 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: - render_tiles.queue_render(db,filename) + queue_render(db,filename) except: None @@ -288,7 +288,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False): if verbose: print("writing training %s" % (filename)) - gpx = pygpx.GPX() + gpx = GPX() 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: - render_tiles.queue_render(db,filename) + queue_render(db,filename) except: None @@ -408,7 +408,7 @@ def main(): 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__": -- 2.34.1