]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/commitdiff
Make vao_ext_id_to_ifopt_stop_id( working for whole Austria.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 18 Jul 2023 22:08:08 +0000 (00:08 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 18 Jul 2023 22:08:08 +0000 (00:08 +0200)
wrpylib/lib_update_public_transport.py

index 7fb80276235a6853a8f5e8aff3bbb4292a30aa0e..8136cda1a2c6b0238ed7c642dacb0f7ee86f99a2 100644 (file)
@@ -27,7 +27,8 @@ def default_query_date(today: date) -> date:
 def vao_ext_id_to_ifopt_stop_id(vao_ext_id: str) -> Optional[str]:
     """Converts a VAO EXT ID like "476164600" to the IFOPT stop ID like "at:47:61646".
     In case the vao_ext_id cannot be converted, None is returned."""
-    if match := re.match(r'(47)(\d{5})00', vao_ext_id):
+    if match := re.match(r'(4[1-9])(\d{5})00$', vao_ext_id):
         g1, g2 = match.groups()
+        g2 = int(g2)
         return f"at:{g1}:{g2}"
     return None