From e4df803d220136dd92d5ca0c58eca3793a71749b Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Fri, 31 Jul 2015 11:09:04 +0200 Subject: [PATCH] custom diff url --- .gitignore | 1 + docker-osmupdate/download.py | 9 ++++++++- downloader.py | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d26da74..37ff373 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ settings/*.pbf settings/*.state.txt settings/*.poly settings/last.state.txt +settings/custom_url_diff.txt diff --git a/docker-osmupdate/download.py b/docker-osmupdate/download.py index efc01e2..9e77a8e 100644 --- a/docker-osmupdate/download.py +++ b/docker-osmupdate/download.py @@ -19,7 +19,7 @@ ***************************************************************************/ """ -from os.path import exists, join, isabs, abspath +from os.path import exists, join, isabs, abspath, isfile from os import listdir, environ from sys import exit from subprocess import call @@ -73,6 +73,13 @@ for f in listdir(default['SETTINGS']): if f.endswith('.poly'): poly_file = join(default['SETTINGS'], f) + """ + # Todo : need fix custom URL and sporadic diff : daily, hourly and minutely + if f == 'custom_url_diff.txt': + with open(join(default['SETTINGS'], f), 'r') as content_file: + default['BASE_URL'] = content_file.read() + """ + if not state_file: print >> stderr, 'State file *.state.txt is missing in %s' % default['SETTINGS'] exit() diff --git a/downloader.py b/downloader.py index 5e3ecca..5169095 100644 --- a/downloader.py +++ b/downloader.py @@ -37,7 +37,7 @@ if url: state = diff + 'state.txt' print 'Polygon file : ' + poly_file print 'PBF file : ' + pbf_file - print 'Diff (not used): ' + diff + print 'Diff URL : ' + diff print 'state : ' + state print 'Downloading PBF' @@ -52,6 +52,10 @@ if url: commands = ['wget', '-c', '-O', 'settings/country.state.txt', state] call(commands) + print 'Setting custom URL diff' + with open('settings/custom_url_diff.txt', 'w') as f: + f.write(diff) + else: print 'This area is unkown in geofabrik or in our script. Check with the list argument.'