Show actual destination in case of incomplete route (e.g. for some international trains)
This commit is contained in:
parent
9d6efef004
commit
37fa7ed358
14
run.py
14
run.py
|
@ -156,8 +156,18 @@ def update_display(display, dbi):
|
|||
text = text.rstrip("Hbf").strip()
|
||||
display.destination.set(text)
|
||||
else:
|
||||
dest = filter_route(train['route'])[-1]['name']
|
||||
dest = re.sub(r"\(.*\)$", "", dest).strip()
|
||||
# Check if the last stop matches the destination.
|
||||
# For some international trains, the route stops at the border,
|
||||
# but the destination is correct.
|
||||
# This is different from cancelled stops, which do show up in the route,
|
||||
# but with the "isCancelled" flag set."
|
||||
if train['route'][-1] != train['destination']:
|
||||
# Incomplete route, show actual destination
|
||||
dest = train['destination']
|
||||
else:
|
||||
# Normal route
|
||||
dest = filter_route(train['route'])[-1]['name']
|
||||
dest = re.sub(r"\(.*\)$", "", dest).strip() # Filter out suffixes in parentheses
|
||||
text = DESTINATION_MAP.get(dest, dest).replace("ß", "ss")
|
||||
if train_type == "S":
|
||||
text = "".join(train['train'].split()) + " " + text
|
||||
|
|
Loading…
Reference in New Issue