Add second display setup, rename to .pyw
This commit is contained in:
parent
278ec3928b
commit
6a72f2e1da
|
@ -8,17 +8,25 @@ from vag_zza import VagZza
|
|||
|
||||
from station_map import *
|
||||
|
||||
import sys, os
|
||||
if sys.executable.endswith("pythonw.exe"):
|
||||
sys.stdout = open(os.devnull, "w");
|
||||
sys.stderr = open(os.path.join(os.getenv("TEMP"), "stderr-"+os.path.basename(sys.argv[0])), "w")
|
||||
|
||||
|
||||
def display_train(zza, train):
|
||||
line = train['Linienname']
|
||||
via = ""
|
||||
if train['Richtungstext'] == "Flughafen":
|
||||
dest = "Bitte achten Sie auf die Zugbeschilderung"
|
||||
else:
|
||||
dest = zza.get_closest_destination(train['Richtungstext'])
|
||||
|
||||
if line == "U1":
|
||||
# Standort Maximilianstraße
|
||||
if dest not in ("Langwasser-Süd", "Fürth Hardhöhe"):
|
||||
line = "U11"
|
||||
|
||||
# Via für Standort Maximilianstraße
|
||||
if dest in ("Fürth Hardhöhe", "Fürth Klinikum", "Fürth / Stadthalle"):
|
||||
via = "Stadtgrenze - Fürth / Hauptbahnhof"
|
||||
elif dest in ("Fürth / Hauptbahnhof", "Jakobinenstraße"):
|
||||
|
@ -30,6 +38,18 @@ def display_train(zza, train):
|
|||
elif dest in ("Scharfreiterring", "Langwasser-Süd"):
|
||||
via = "Plärrer - Hauptbahnhof - Messe"
|
||||
|
||||
if line == "U2":
|
||||
# Standort Rennweg
|
||||
if dest not in ("Bitte achten Sie auf die Zugbeschilderung", "Röthenbach"):
|
||||
line = "U21"
|
||||
|
||||
if dest in ("Hauptbahnhof", "Plärrer"):
|
||||
via = "Rathenauplatz"
|
||||
elif dest in ("St. Leonhard", "Schweinau"):
|
||||
via = "Rathenauplatz - Hauptbahnhof - Plärrer"
|
||||
elif dest in ("Hohe Marter", "Röthenbach"):
|
||||
via = "Rothenburgerstraße - Schweinau"
|
||||
|
||||
if dest == "":
|
||||
line = "Sonderzug"
|
||||
dest = "Bitte achten Sie auf die Zugbeschilderung"
|
||||
|
@ -44,6 +64,7 @@ def main():
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-p", "--port", type=str, required=True, help="Serial port for display")
|
||||
parser.add_argument("-s", "--station", type=str, required=True, help="Station name to display departures of")
|
||||
parser.add_argument("-pl", "--platform", type=int, required=True, help="Which platform the display is on")
|
||||
args = parser.parse_args()
|
||||
|
||||
api = VagApi()
|
||||
|
@ -55,6 +76,12 @@ def main():
|
|||
station_id = api.get_station_info(args.station)[0]['VGNKennung']
|
||||
|
||||
departures = api.get_departures(station_id, products=["Ubahn"])
|
||||
if len(departures) == 0:
|
||||
train = {
|
||||
"Linienname": "",
|
||||
"Richtungstext": f"Betriebsschluß Gleis {args.platform}"
|
||||
}
|
||||
else:
|
||||
train = departures[0]
|
||||
|
||||
zza = VagZza(args.port)
|
Loading…
Reference in New Issue