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/*.poly
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 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()

Wyświetl plik

@ -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.'