]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/commitdiff
Use the "Fahrplan Abfahrtsmonitor VVT" to derive ifopt_stop_id.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 15 Jul 2023 22:00:11 +0000 (00:00 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 15 Jul 2023 22:00:11 +0000 (00:00 +0200)
scripts/update_public_transport_bus_stops.py

index d11e50c10ae05d3f2315d38638b1244446e2228b..17651caab05f6e2ceb10fc53245d7dc49631d8a6 100644 (file)
@@ -41,6 +41,11 @@ def update_sledrun(site: WikiSite, bus_stop_geojson: GeoJSON, title: str):
                 g1, g2 = match.groups()
                 pt_stop['ifopt_stop_id'] = f"at:{g1}:{g2}"
                 continue
+        if monitor_template := pt_stop.get('monitor_template'):
+            if monitor_template.get('name') == "Fahrplan Abfahrtsmonitor VVT":
+                vvt_stop_id = int(monitor_template['parameter'][2]['value'])
+                pt_stop['ifopt_stop_id'] = f'at:47:{vvt_stop_id}'
+                continue
         if position_elevation := pt_stop.get('position'):
             if position := position_elevation.get('position'):
                 bus_stop_feature_list = bus_stop_geojson['features']
@@ -51,7 +56,7 @@ def update_sledrun(site: WikiSite, bus_stop_geojson: GeoJSON, title: str):
                 if distance_m < 30:
                     name1 = pt_stop["name"] if "name" in pt_stop else pt_stop.get("name_local", "(unnamed stop)")
                     name2 = closest_bus_stop_feature['properties']["hst_name"]
-                    choice = input_yes_no_quit(f'Assign "{name1}" to "{name2}" [yes, no, quit]?', None)
+                    choice = input_yes_no_quit(f'Assign "{name1}" to "{name2}" [yes, no, quit]? ', None)
                     if choice == Choice.no:
                         return
                     elif choice == Choice.quit: