Phalos-Typ-M-ZZA/settings_phalos.py

219 lines
13 KiB
Python

from pyfis.splitflap_display import SplitFlapDisplay, TextField, CustomMapField, MirrorField
def _load_map(file):
_map = {}
with open(file, 'r') as f:
lines = f.readlines()
for line in lines:
line = line.strip()
if not line:
continue
parts = line.split(maxsplit=1)
pos = int(parts[0])
if len(parts) > 1:
text = parts[1]
_map[pos] = text
return _map
SERIAL_PORT = "/dev/serial/by-path/platform-3f980000.usb-usb-0:1.5:1.0-port0"
DBI_HOST = "trains.xatlabs.com"
STATION_CODE = "RM"
STATION_NAME = "Mannheim Hbf"
PLATFORM = "0"
DEFAULT_OPERATOR = "DB"
ARRIVAL_HOUR_FORMAT = "Ankunft {}"
ARRIVAL_MIN_FORMAT = "{:02d}"
DEPARTURE_HOUR_FORMAT = "Abfahrt {}"
DEPARTURE_MIN_FORMAT = "{:02d}"
PLATFORM_CHANGE_FORMAT = "heute aus Gleis {}"
OUT_OF_ORDER_TEXT = ""
NO_TRAINS_TEXT = ""
CANCELLED_TEXT = ""
DELAY_FORMAT = "etwa {} Min. später"
DELAY_ABOVE_FORMAT = "Über {} Min. später"
SMALL_DELAY_TEXT = ""
UNSPECIFIC_DELAY_TEXT = "Über 60 Min. später"
DO_NOT_BOARD_TEXT = "Nicht einsteigen"
NO_STOP_EVERYWHERE_TEXT = "Hält nicht überall"
MAP_HOUR = dict([(i, f"Abfahrt {i}") for i in range(24)] + [(i+30, f"Ankunft {i}") for i in range(24)])
MAP_MINUTE = dict([(i, f"{i:02d}") for i in range(60)])
MAP_INFO_1 = _load_map("map_hinweis1.txt")
MAP_INFO_2 = _load_map("map_hinweis2.txt")
MAP_ALNUM = _load_map("map_alnum.txt")
VIA_1 = {
0: {'text': "Schwetzingen", 'stations': ["Schwetzingen"]},
1: {'text': "Karlsruhe", 'stations': ["Karlsruhe Hbf"]},
2: {'text': "Karlsruhe - Baden-Baden", 'stations': ["Karlsruhe Hbf", "Baden-Baden"]},
3: {'text': "Karlsruhe - Kehl", 'stations': ["Karlsruhe Hbf", "Kehl"]},
4: {'text': "Karlsruhe - Offenburg", 'stations': ["Karlsruhe Hbf", "Offenburg"]},
5: {'text': "Karlsruhe - Basel Bad Bf", 'stations': ["Karlsruhe Hbf", "Basel Bad Bf"]},
6: {'text': "Karlsruhe - Basel SBB", 'stations': ["Karlsruhe Hbf", "Basel SBB"]},
7: {'text': "Karlsruhe - Baden-Baden - Offenburg - Freiburg", 'stations': ["Karlsruhe Hbf", "Baden-Baden", "Offenburg", "Freiburg(Breisgau) Hbf"]},
8: {'text': "Chiasso - Milano", 'stations': ["Chiasso", "Milano Centrale"]},
9: {'text': "Bruchsal - Stuttgart", 'stations': ["Bruchsal", "Stuttgart Hbf"]},
10: {'text': "Heidelberg", 'stations': ["Heidelberg Hbf"]},
11: {'text': "Heidelberg - Bruchsal", 'stations': ["Heidelberg Hbf", "Bruchsal"]},
12: {'text': "Heidelberg - Karlsruhe", 'stations': ["Heidelberg Hbf", "Karlsruhe Hbf"]},
13: {'text': "Heidelberg - Sinsheim", 'stations': ["Heidelberg Hbf", "Sinsheim(Elsenz) Hbf"]},
14: {'text': "Heidelberg - Neckarelz", 'stations': ["Heidelberg Hbf", "Mosbach-Neckarelz"]},
15: {'text': "Heidelberg - Stuttgart", 'stations': ["Heidelberg Hbf", "Stuttgart Hbf"]},
16: {'text': "Heidelberg - München", 'stations': ["Heidelberg Hbf", "München Hbf"]},
17: {'text': "Heidelberg - Eberbach", 'stations': ["Heidelberg Hbf", "Eberbach"]},
18: {'text': "Stuttgart", 'stations': ["Stuttgart Hbf"]},
19: {'text': "Neustadt - Kaiserslautern", 'stations': ["Neustadt(Weinstr)Hbf", "Kaiserslautern"]},
20: {'text': "Heppenheim (Bergstr)", 'stations': ["Heppenheim(Bergstr)"]},
21: {'text': "Bensheim - Darmstadt", 'stations': ["Bensheim", "Darmstadt Hbf"]},
22: {'text': "MA-Friedrichsfeld", 'stations': ["Mannheim-Friedrichsfeld Süd"]},
23: {'text': "Weinheim", 'stations': ["Weinheim(Bergstr)Hbf"]},
24: {'text': "Darmstadt - Frankfurt", 'stations': ["Darmstadt Hbf", "Frankfurt(Main)Hbf"]},
25: {'text': "Darmstadt - Mainz - Wiesbaden - Bonn", 'stations': ["Darmstadt Hbf", "Mainz Hbf", "Wiesbaden Hbf", "Bonn Hbf"]},
26: {'text': "Darmstadt - Mainz - Bonn", 'stations': ["Darmstadt Hbf", "Mainz Hbf", "Bonn Hbf"]},
27: {'text': "Frankfurt/M", 'stations': ["Frankfurt(Main)Hbf"]},
28: {'text': "Frankfurt/M - Bebra", 'stations': ["Frankfurt(Main)Hbf", "Bebra"]},
29: {'text': "Frankfurt(M) - Hannover", 'stations': ["Frankfurt(Main)Hbf", "Hannover Hbf"]},
30: {'text': "Frankfurt/M - Fulda", 'stations': ["Frankfurt(Main)Hbf", "Fulda"]},
31: {'text': "MA-Käfertal", 'stations': ["Mannheim-Käfertal"]},
32: {'text': "MA-Luzenberg", 'stations': ["Mannheim-Luzenberg"]},
33: {'text': "MA-Waldhof", 'stations': ["Mannheim-Waldhof"]},
34: {'text': "MA-Neckarstadt", 'stations': ["Mannheim-Neckarstadt"]},
35: {'text': "Ludwigshafen - Neustadt", 'stations': ["Ludwigshafen(Rh)Hbf", "Neustadt(Weinstr)Hbf"]},
36: {'text': "Mainz", 'stations': ["Mainz Hbf"]},
37: {'text': "Ludwigshafen (Rh)", 'stations': ["Ludwigshafen(Rh)Hbf"]},
38: {'text': "Ludwigshafen - Speyer", 'stations': ["Ludwigshafen(Rh)Hbf", "Speyer Hbf"]},
39: {'text': "Neustadt (Weinstr)", 'stations': ["Neustadt(Weinstr)Hbf"]},
40: {'text': "Ludwigshafen - Mainz", 'stations': ["Ludwigshafen(Rh)Hbf", "Mainz Hbf"]},
41: {'text': "Ludwigshafen - Worms", 'stations': ["Ludwigshafen(Rh)Hbf", "Worms Hbf"]},
42: {'text': "MA-Seckenheim", 'stations': ["Mannheim-Seckenheim"]},
43: {'text': "Heidelberg - Stuttgart - Ulm - Augsburg", 'stations': ["Heidelberg Hbf", "Stuttgart Hbf", "Ulm Hbf", "Augsburg Hbf"]},
44: {'text': "Frankfurt(M) - Kassel-Wilhelmshöhe", 'stations': ["Frankfurt(Main)Hbf", "Kassel-Wilhelmshöhe"]},
45: {'text': "Milano - Bologna", 'stations': ["Milano Centrale", "Bologna Centrale"]},
46: {'text': "Chiasso", 'stations': ["Chiasso"]},
47: {'text': "Worms - Bonn - Köln", 'stations': ["Worms Hbf", "Bonn Hbf", "Köln Hbf"]},
48: {'text': "Mainz - Koblenz", 'stations': ["Mainz Hbf", "Koblenz Hbf"]},
49: {'text': "Mainz - Koblenz - Bonn - Köln", 'stations': ["Mainz Hbf", "Koblenz Hbf", "Bonn Hbf", "Köln Hbf"]},
50: {'text': "Mainz - Bonn - Köln", 'stations': ["Mainz Hbf", "Bonn Hbf", "Köln Hbf"]},
51: {'text': "Mainz - Bonn", 'stations': ["Mainz Hbf", "Bonn Hbf"]},
52: {'text': "Mainz - Köln", 'stations': ["Mainz Hbf", "Köln Hbf"]},
53: {'text': "Mainz - Bonn - Köln - Essen - Dortmund", 'stations': ["Mainz Hbf", "Bonn Hbf", "Köln Hbf", "Essen Hbf", "Dortmund Hbf"]},
54: {'text': "Mainz - Bonn - Köln - Hagen - Dortmund", 'stations': ["Mainz Hbf", "Bonn Hbf", "Köln Hbf", "Hagen Hbf", "Dortmund Hbf"]},
56: {'text': "Ludwigshafen - Freinsheim", 'stations': ["Ludwigshafen(Rh)Hbf", "Freinsheim"]},
58: {'text': "Frankfurt(M) - KS-Wilhelmshöhe", 'stations': ["Frankfurt(Main)Hbf", "Kassel-Wilhelmshöhe"]},
59: {'text': "Worms - Mainz", 'stations': ["Worms Hbf", "Mainz Hbf"]},
61: {'text': "Frankfurt/M Flughafen", 'stations': ["Frankfurt(M) Flughafen Fernbf"]},
99: {'text': "", 'stations': []}
}
MAP_VIA_1 = {key: value['text'] for key, value in VIA_1.items()}
VIA_2 = {
0: {'text': "Karlsruhe", 'stations': ["Karlsruhe Hbf"]},
1: {'text': "Offenburg", 'stations': ["Offenburg"]},
2: {'text': "Offenburg - Freiburg", 'stations': ["Offenburg", "Freiburg(Breisgau) Hbf"]},
3: {'text': "Freiburg(Brsg)", 'stations': ["Freiburg(Breisgau) Hbf"]},
4: {'text': "Freiburg - Basel SBB", 'stations': ["Freiburg(Breisgau) Hbf", "Basel SBB"]},
5: {'text': "Heilbronn", 'stations': ["Heilbronn Hbf"]},
6: {'text': "Crailsheim", 'stations': ["Crailsheim"]},
7: {'text': "Ulm", 'stations': ["Ulm Hbf"]},
8: {'text': "Ulm - Lindau", 'stations': ["Ulm Hbf", ["Lindau-Insel", "Lindau-Aeschach", "Lindau-Reutin"]]},
9: {'text': "Ulm - Augsburg", 'stations': ["Ulm Hbf", "Augsburg Hbf"]},
10: {'text': "München", 'stations': ["München Hbf"]},
11: {'text': "München - Kufstein", 'stations': ["München Hbf", "Kufstein"]},
12: {'text': "München - Salzburg", 'stations': ["München Hbf", "Salzburg Hbf"]},
13: {'text': "Salzburg", 'stations': ["Salzburg Hbf"]},
14: {'text': "Bebra", 'stations': ["Bebra"]},
15: {'text': "Bebra - Erfurt", 'stations': ["Bebra", "Erfurt Hbf"]},
16: {'text': "Frankfurt/M Süd", 'stations': ["Frankfurt(Main)Süd"]},
17: {'text': "Hannover", 'stations': ["Hannover Hbf"]},
18: {'text': "Hamburg", 'stations': [["Hamburg Hbf", "Hamburg-Altona"]]},
19: {'text': "Hannover - Hamburg", 'stations': ["Hannover Hbf", ["Hamburg Hbf", "Hamburg-Altona"]]},
20: {'text': "Saarbrücken", 'stations': ["Saarbrücken Hbf"]},
21: {'text': "Frankfurt Sportfeld", 'stations': ["Frankfurt am Main - Stadion"]},
22: {'text': "Mainz", 'stations': ["Mainz Hbf"]},
23: {'text': "Bonn - Köln - Essen", 'stations': ["Bonn Hbf", "Köln Hbf", "Essen Hbf"]},
24: {'text': "Aachen", 'stations': ["Aachen Hbf"]},
25: {'text': "Nijmegen", 'stations': ["Nijmegen"]},
26: {'text': "Venlo", 'stations': ["Venlo"]},
27: {'text': "Düsseldorf - Emmerich", 'stations': ["Düsseldorf Hbf", "Emmerich"]},
28: {'text': "Düsseldorf - Essen", 'stations': ["Düsseldorf Hbf", "Essen Hbf"]},
29: {'text': "Essen - Dortmund", 'stations': ["Essen Hbf", "Dortmund Hbf"]},
30: {'text': "Essen - Gelsenkirchen", 'stations': ["Essen Hbf", "Gelsenkirchen Hbf"]},
31: {'text': "Hagen", 'stations': ["Hagen Hbf"]},
32: {'text': "Hagen - Dortmund", 'stations': ["Hagen Hbf", "Dortmund Hbf"]},
33: {'text': "Bremen", 'stations': ["Bremen Hbf"]},
34: {'text': "Forbach - Bordeaux", 'stations': [["Forbach(F)", "Forbach(Schwarzw)"], "Bordeaux-St-Jean"]},
35: {'text': "Basel Bad Bf", 'stations': ["Basel Bad Bf"]},
36: {'text': "Basel SBB", 'stations': ["Basel SBB"]},
37: {'text': "MA- Waldhof", 'stations': ["Mannheim-Waldhof"]},
38: {'text': "MA-Friedrichsfeld Süd", 'stations': ["Mannheim-Friedrichsfeld Süd"]},
39: {'text': "Hockenheim", 'stations': ["Hockenheim"]},
40: {'text': "Weinheim (Bergstr)", 'stations': ["Weinheim(Bergstr)Hbf"]},
41: {'text': "Vaihingen (Enz)", 'stations': ["Vaihingen(Enz)"]},
42: {'text': "Homburg (Saar)", 'stations': ["Homburg(Saar)Hbf"]},
43: {'text': "Leipzig - Dresden", 'stations': ["Leipzig Hbf", "Dresden Hbf"]},
44: {'text': "Braunschweig - Magdeburg", 'stations': ["Braunschweig Hbf", "Magdeburg Hbf"]},
45: {'text': "Erfurt - Leipzig", 'stations': ["Erfurt Hbf", "Leipzig Hbf"]},
46: {'text': "Eisenach - Erfurt", 'stations': ["Eisenach", "Erfurt Hbf"]},
47: {'text': "Neustadt - Kaiserslautern", 'stations': ["Neustadt(Weinstr)Hbf", "Kaiserslautern Hbf"]},
48: {'text': "Worms - Biblis", 'stations': ["Worms Hbf", "Biblis"]},
49: {'text': "Graben-Neudorf", 'stations': ["Graben-Neudorf"]},
50: {'text': "Gießen", 'stations': ["Gießen"]},
51: {'text': "München - Kufstein - Innsbruck - Verona", 'stations': ["München Hbf", "Kufstein", "Innsbruck Hbf", "Verona Porta Nuova"]},
52: {'text': "Darmstadt", 'stations': ["Darmstadt Hbf"]},
53: {'text': "Biblis", 'stations': ["Biblis"]},
54: {'text': "Germersheim - Wörth", 'stations': ["Germersheim", "Wörth(Rhein)"]},
55: {'text': "Kaiserslautern - Saarbrücken", 'stations': ["Kaiserslautern Hbf", "Saarbrücken Hbf"]},
56: {'text': "Bruchsal", 'stations': ["Bruchsal"]},
57: {'text': "Landau", 'stations': ["Landau(Pfalz)Hbf"]},
58: {'text': "Koblenz - Bonn", 'stations': ["Koblenz Hbf", "Bonn Hbf"]},
59: {'text': "München - Mittenwald", 'stations': ["München Hbf", "Mittenwald"]},
60: {'text': "Braunschweig", 'stations': ["Braunschweig Hbf"]},
61: {'text': "Kassel-Wi. - Hannover", 'stations': ["Kassel-Wilhelmshöhe", "Hannover Hbf"]},
63: {'text': "Strasbourg - Avignon", 'stations': ["Strasbourg", "Avignon Centre"]},
99: {'text': "", 'stations': []}
}
MAP_VIA_2 = {key: value['text'] for key, value in VIA_2.items()}
DESTINATION_MAP = {
"Frankfurt(Main)Hbf": "Frankfurt Hbf",
"Freiburg(Breisgau) Hbf": "Freiburg Hbf",
"Homburg(Saar)Hbf": "Homburg (Saar)",
"Neustadt(Weinstr)Hbf": "Neustadt Hbf",
"Mosbach(Baden)": "Mosbach",
"Berlin Hbf (tief)": "Berlin Hbf",
}
VIA_MAP = {
}
VIA_WEIGHTS = {
}
class TypMZZA(SplitFlapDisplay):
hour = CustomMapField(MAP_HOUR, start_address=1, x=0, y=0, module_width=12, module_height=2, home_pos=99)
minute = CustomMapField(MAP_MINUTE, start_address=2, x=12, y=0, module_width=4, module_height=2, home_pos=99)
info_1 = CustomMapField(MAP_INFO_1, start_address=4, x=0, y=2, module_width=16, module_height=2, home_pos=99)
info_2 = CustomMapField(MAP_INFO_2, start_address=5, x=0, y=4, module_width=16, module_height=2, home_pos=99)
via_1 = CustomMapField(MAP_VIA_1, start_address=6, x=16, y=2, module_width=16, module_height=2, home_pos=99)
via_2 = CustomMapField(MAP_VIA_2, start_address=7, x=16, y=4, module_width=16, module_height=2, home_pos=99)
destination = TextField(start_address=8, length=16, x=0, y=6, module_width=2, module_height=2, display_mapping=MAP_ALNUM, home_pos=99)
hour_b = MirrorField(hour, start_address=24, x=0, y=10)
minute_b = MirrorField(minute, start_address=25, x=12, y=10)
info_1_b = MirrorField(info_1, start_address=26, x=0, y=12)
info_2_b = MirrorField(info_2, start_address=28, x=0, y=14)
via_1_b = MirrorField(via_1, start_address=27, x=16, y=12)
via_2_b = MirrorField(via_2, start_address=29, x=16, y=14)
destination_b = MirrorField(destination, start_address=30, length=16, x=0, y=16)