]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/commitdiff
Make parsing of "Fahrplan Abfahrtsmonitor VVT" without VVT stop ID possible.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 16 Jul 2023 07:35:59 +0000 (09:35 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 16 Jul 2023 07:35:59 +0000 (09:35 +0200)
scripts/update_public_transport_bus_stops.py

index 17651caab05f6e2ceb10fc53245d7dc49631d8a6..a40aa60bd4c734faebe493b40c46439c9cfd992d 100644 (file)
@@ -43,9 +43,11 @@ def update_sledrun(site: WikiSite, bus_stop_geojson: GeoJSON, title: str):
                 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
+                parameter = monitor_template['parameter']
+                if len(parameter) == 3:
+                    vvt_stop_id = int(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']