Update train type map
This commit is contained in:
parent
ac5c2153df
commit
70319e511e
24
run.py
24
run.py
|
@ -72,14 +72,6 @@ def update_display(display, dbi):
|
|||
# Train number starts with a letter
|
||||
train_type = parts[0] = parts[1].rstrip("0123456789")
|
||||
parts[1] = parts[1][len(parts[0]):]
|
||||
|
||||
if train_type == "RE" and any([stop.get('isCancelled') for stop in train['route']]):
|
||||
# If we have an RE train and any stop on the way is cancelled
|
||||
display.info_1.set("RE hält nicht überall")
|
||||
|
||||
if train_type in ("BRB", "RB", "ALX", "WB") and any([stop.get('isCancelled') for stop in train['route']]):
|
||||
# If we have an RB train and any stop on the way is cancelled
|
||||
display.info_1.set("RB hält nicht überall")
|
||||
|
||||
is_arrival = any(filter(lambda arrival_station_name: filter_route(train['route'])[-1]['name'].startswith(arrival_station_name), ARRIVAL_STATIONS))
|
||||
|
||||
|
@ -125,8 +117,20 @@ def update_display(display, dbi):
|
|||
train_length_pos = random.randint(36, 45)
|
||||
display.info_2.set(MAP_INFO_2[train_length_pos])
|
||||
|
||||
train_type_text = TRAIN_TYPE_MAP.get(train_type, "")
|
||||
display.info_1.set(train_type_text)
|
||||
if train_type == "BRB":
|
||||
# Special case for BRB because it's on info_2
|
||||
display.info_2.set("BRB Bayerische Regiobahn")
|
||||
else:
|
||||
train_type_text = TRAIN_TYPE_MAP.get(train_type, "")
|
||||
display.info_1.set(train_type_text)
|
||||
|
||||
if train_type == "RE" and any([stop.get('isCancelled') for stop in train['route']]):
|
||||
# If we have an RE train and any stop on the way is cancelled
|
||||
display.info_1.set("RE hält nicht überall")
|
||||
|
||||
if train_type in ("BRB", "RB", "ALX", "WB") and any([stop.get('isCancelled') for stop in train['route']]):
|
||||
# If we have an RB train and any stop on the way is cancelled
|
||||
display.info_1.set("RB hält nicht überall")
|
||||
|
||||
route = route_from([VIA_MAP.get(stop['name'], stop['name']) for stop in [s for s in train['route'] if not s.get('isCancelled')]], STATION_NAME)[:-1]
|
||||
via_combination = get_vias(route, VIA_WEIGHTS, VIA_1, VIA_2, check_dashes=False, debug=True)
|
||||
|
|
|
@ -145,14 +145,21 @@ ARRIVAL_MAP = {
|
|||
|
||||
TRAIN_TYPE_MAP = {
|
||||
"TGV": "D Schnellzug",
|
||||
"EC": "EC EuroCity",
|
||||
"IC": "IC InterCity",
|
||||
"IR": "InterRegio",
|
||||
"RB": "RegionalBahn",
|
||||
"RE": "RegionalExpress",
|
||||
"EC": "EC EuroCity",
|
||||
"IC": "IC InterCity",
|
||||
"IR": "InterRegio",
|
||||
"RB": "RegionalBahn",
|
||||
"RE": "RegionalExpress",
|
||||
"IRE": "InterRegioExpress",
|
||||
"ICE": "ICE InterCityExpress",
|
||||
"BRB": "RegionalBahn",
|
||||
"EN": "EuroNight",
|
||||
"NJ": "EuroNight",
|
||||
"ECE": "ECE EuroCityExpress",
|
||||
"RJ": "railjet",
|
||||
"S": "MVV Münchner Verkehrs- und Tarifverbund",
|
||||
"RJX": "MÁV Magyar Államvasutak",
|
||||
"ALX": "alex",
|
||||
}
|
||||
|
||||
VIA_MAP = {
|
||||
|
|
Loading…
Reference in New Issue