mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
commit
33b8c06f57
1 changed files with 8 additions and 10 deletions
|
@ -54,7 +54,6 @@ def main():
|
|||
# For installed regions, check that a menu def exists, and it's on home page
|
||||
for fname in installed_maps:
|
||||
region = extract_region_from_filename(fname)
|
||||
print('checking for %s region'%region)
|
||||
if region == 'maplist': # it is the splash page, display only if no others
|
||||
menu_ref = 'en-map_test'
|
||||
item = { "perma_ref" : "en-map_test" }
|
||||
|
@ -105,7 +104,7 @@ def get_installed_regions():
|
|||
os.chdir(map_doc_root)
|
||||
for filename in os.listdir('.'):
|
||||
if fnmatch.fnmatch(filename, '??-osm-omt*'):
|
||||
region = re.sub(r'^..-osm-omt_(.*)',r'\1',filename)
|
||||
region = re.sub(r'^..-osm-..._(.*)',r'\1',filename)
|
||||
installed.append(region)
|
||||
# add the splash page if no other maps are present
|
||||
if len(installed) == 0:
|
||||
|
@ -192,14 +191,13 @@ def fetch_menu_json_value(key):
|
|||
return data.get(key,'')
|
||||
|
||||
def extract_region_from_filename(fname):
|
||||
substitutions = { "north": "north_america",\
|
||||
"central": "central_america",\
|
||||
"southeast": "southeast_asia",
|
||||
"south": "south_america" }
|
||||
# wish I had used - as separator between key and date
|
||||
nibble = fname.split('_')[0]
|
||||
nibble = substitutions.get(nibble,nibble)
|
||||
return(nibble)
|
||||
# find the index of the date
|
||||
nibble = re.search(r"\d{4}-\d{2}-\d{2}",fname)
|
||||
if nibble:
|
||||
fname = fname[:nibble.start()-1]
|
||||
return fname
|
||||
else:
|
||||
return("maplist")
|
||||
|
||||
if __name__ == '__main__':
|
||||
if console_installed:
|
||||
|
|
Loading…
Reference in a new issue