Compare commits

..

No commits in common. "74fff341be5a98133963c62b981adf950705ec79" and "2df827d3adef6d9f2fde7861f5f1a4c1754cf199" have entirely different histories.

1 changed files with 14 additions and 25 deletions

25
stop.py
View File

@ -17,16 +17,7 @@ line_types = (
'Lianes', 'Lianes',
'Ligne', 'Ligne',
'Bus Relais', 'Bus Relais',
'Citéis',
) )
line_translate = {
'Tram A': 'A',
'Tram B': 'B',
'Tram C': 'C',
'Tram D': 'D',
'TBNight': '58',
'BAT3': '69',
}
def search_stop_by_name (keyword): def search_stop_by_name (keyword):
@ -102,24 +93,22 @@ def show_stops_from_ref (ref):
'terminus': j ['name'], 'terminus': j ['name'],
'line_human': j ['line'] ['name'], 'line_human': j ['line'] ['name'],
} }
add = False
if rte ['line_human'] in line_translate:
line_id = line_translate [rte ['line_human']]
add = True
else:
try: try:
line_id = search ('[0-9]+$', rte ['line_human']).group () line_id = search ('[0-9A-D]+$', rte ['line_human']).group ()
except AttributeError: except AttributeError:
continue continue
try:
line_id = '%02d' % int (line_id) line_id = '%02d' % int (line_id)
except ValueError:
pass
a = False
for i in line_types: for i in line_types:
if rte ['line_human'] [0:len (i)] == i: if rte ['line_human'] [0:len (i)] == i:
add = True a = True
break break
if add: if a:
rte ['line_id'] = line_id rte ['line_id'] = line_id
s ['routes'].append (rte) s ['routes'].append (rte)
if s ['routes'] != []:
r ['stop_points'].append (s) r ['stop_points'].append (s)
return (r) return (r)