Merge pull request #5 from Gustry/develop

Fix OSM directory and small changes
pull/6/head
Etienne Trimaille 2015-07-30 15:16:43 +02:00
commit 486ae708a0
4 zmienionych plików z 12 dodań i 11 usunięć

1
.gitignore vendored
Wyświetl plik

@ -2,3 +2,4 @@
*.*~ *.*~
osm_pbf/*.pbf osm_pbf/*.pbf
osm_pbf/*.state.txt osm_pbf/*.state.txt
settings/last.state.txt

Wyświetl plik

@ -163,4 +163,4 @@ while True:
if len(listdir(default['IMPORT_QUEUE'])) == 0: if len(listdir(default['IMPORT_QUEUE'])) == 0:
print 'Sleeping for %s seconds.' % default['TIME'] print 'Sleeping for %s seconds.' % default['TIME']
sleep(default['TIME']) sleep(float(default['TIME']))

Wyświetl plik

@ -18,7 +18,7 @@ default = {
'BASE_URL': 'http://planet.openstreetmap.org/replication/', 'BASE_URL': 'http://planet.openstreetmap.org/replication/',
'IMPORT_QUEUE': 'import_queue', 'IMPORT_QUEUE': 'import_queue',
'IMPORT_DONE': 'import_done', 'IMPORT_DONE': 'import_done',
'BASE_PBF': 'base_pbf', 'OSM_PBF': 'osm_pbf',
'TIME': 120, 'TIME': 120,
} }
@ -27,7 +27,7 @@ for key in default.keys():
default[key] = environ[key] default[key] = environ[key]
# Folders # Folders
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'BASE_PBF'] folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'OSM_PBF']
for folder in folders: for folder in folders:
if not isabs(default[folder]): if not isabs(default[folder]):
# Get the absolute path. # Get the absolute path.
@ -42,26 +42,26 @@ for folder in folders:
state_file = None state_file = None
osm_file = None osm_file = None
poly_file = None poly_file = None
for f in listdir(default['BASE_PBF']): for f in listdir(default['OSM_PBF']):
if f.endswith('.state.txt'): if f.endswith('.state.txt'):
state_file = join(default['BASE_PBF'], f) state_file = join(default['OSM_PBF'], f)
if f.endswith('.osm.pbf'): if f.endswith('.osm.pbf'):
osm_file = join(default['BASE_PBF'], f) osm_file = join(default['OSM_PBF'], f)
if f.endswith('.poly'): if f.endswith('.poly'):
poly_file = join(default['BASE_PBF'], f) poly_file = join(default['OSM_PBF'], f)
if not state_file: if not state_file:
print >> stderr, 'State file *.state.txt is missing in %s' % default['BASE_PBF'] print >> stderr, 'State file *.state.txt is missing in %s' % default['OSM_PBF']
exit() exit()
if not osm_file: if not osm_file:
print >> stderr, 'OSM file *.osm.pbf is missing in %s' % default['BASE_PBF'] print >> stderr, 'OSM file *.osm.pbf is missing in %s' % default['OSM_PBF']
exit() exit()
if not poly_file: if not poly_file:
print 'No *.poly detected in %s' % default['BASE_PBF'] print 'No *.poly detected in %s' % default['OSM_PBF']
else: else:
print '%s detected for clipping.' % poly_file print '%s detected for clipping.' % poly_file
@ -119,4 +119,4 @@ while True:
# Sleep # Sleep
print 'Sleeping for %s seconds.' % default['TIME'] print 'Sleeping for %s seconds.' % default['TIME']
sleep(default['TIME']) sleep(float(default['TIME']))