custom diff url

pull/11/head
Etienne Trimaille 2015-07-31 11:09:04 +02:00
rodzic 524883bc81
commit e4df803d22
3 zmienionych plików z 14 dodań i 2 usunięć

1
.gitignore vendored
Wyświetl plik

@ -4,3 +4,4 @@ settings/*.pbf
settings/*.state.txt settings/*.state.txt
settings/*.poly settings/*.poly
settings/last.state.txt settings/last.state.txt
settings/custom_url_diff.txt

Wyświetl plik

@ -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 os import listdir, environ
from sys import exit from sys import exit
from subprocess import call from subprocess import call
@ -73,6 +73,13 @@ for f in listdir(default['SETTINGS']):
if f.endswith('.poly'): if f.endswith('.poly'):
poly_file = join(default['SETTINGS'], f) 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: if not state_file:
print >> stderr, 'State file *.state.txt is missing in %s' % default['SETTINGS'] print >> stderr, 'State file *.state.txt is missing in %s' % default['SETTINGS']
exit() exit()

Wyświetl plik

@ -37,7 +37,7 @@ if url:
state = diff + 'state.txt' state = diff + 'state.txt'
print 'Polygon file : ' + poly_file print 'Polygon file : ' + poly_file
print 'PBF file : ' + pbf_file print 'PBF file : ' + pbf_file
print 'Diff (not used): ' + diff print 'Diff URL : ' + diff
print 'state : ' + state print 'state : ' + state
print 'Downloading PBF' print 'Downloading PBF'
@ -52,6 +52,10 @@ if url:
commands = ['wget', '-c', '-O', 'settings/country.state.txt', state] commands = ['wget', '-c', '-O', 'settings/country.state.txt', state]
call(commands) call(commands)
print 'Setting custom URL diff'
with open('settings/custom_url_diff.txt', 'w') as f:
f.write(diff)
else: else:
print 'This area is unkown in geofabrik or in our script. Check with the list argument.' print 'This area is unkown in geofabrik or in our script. Check with the list argument.'