Allow multiple station names for detecting arrivals

This commit is contained in:
Julian Metzler 2022-10-26 01:26:39 +02:00
parent 5e2f22758d
commit 591efbbed1
2 changed files with 3 additions and 2 deletions

4
run.py
View File

@ -42,7 +42,7 @@ def update_display(display, dbi):
elif PLATFORMS_EXCLUDE:
trains = list(filter(lambda t: t['platform'] not in PLATFORMS_EXCLUDE, trains))
# Remove arrivals
trains = list(filter(lambda t: not t['destination'].startswith(STATION_NAME), trains))
trains = list(filter(lambda t: not any(filter(lambda arrival_station_name: t['destination'].startswith(arrival_station_name), ARRIVAL_STATIONS)), trains))
except:
traceback.print_exc()
display.info_1.set(OUT_OF_ORDER_TEXT)
@ -72,7 +72,7 @@ def update_display(display, dbi):
if train_type == "RE":
display.info_2.set(NO_STOP_EVERYWHERE_TEXT)
is_arrival = train['destination'].startswith(STATION_NAME)
is_arrival = any(filter(lambda arrival_station_name: train['destination'].startswith(arrival_station_name), ARRIVAL_STATIONS))
#if train['platform'] != PLATFORM:
# platform = int("".join(c for c in train['platform'] if c.isdigit()))

View File

@ -22,6 +22,7 @@ SERIAL_PORT = "/dev/serial/by-path/platform-3f980000.usb-usb-0:1.5:1.0-port0"
DBI_HOST = "trains.xatlabs.com"
STATION_CODE = "MH"
STATION_NAME = "München Hbf"
ARRIVAL_STATIONS = ["München Hbf", "München Hauptbahnhof"]
PLATFORM = "0"
PLATFORMS_INCLUDE = None
PLATFORMS_EXCLUDE = ["1", "2"]