-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtf.py
More file actions
15 lines (13 loc) · 768 Bytes
/
btf.py
File metadata and controls
15 lines (13 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from main import mvg_api
from datetime import datetime
station_names = ["Klinikum Großhadern", "Max-Lebsche Platz"]
by_station = mvg_api(station_names, api_type="departures", combine_departures=False)
# Alle Abfahrten kombiniert und nach Zeit sortiert
all_deps = mvg_api(station_names, api_type="departures", combine_departures=True)
print("\nCombined & Sorted Departures:")
for dep in all_deps[:10]: # nur die nächsten 10
station_name = dep["_station_name"]
line = dep.get("line") if isinstance(dep.get("line"), str) else dep.get("line", {}).get("name", "Unknown")
dest = dep.get("destination", "Unknown")
planned = datetime.fromtimestamp(dep.get("planned")).strftime("%H:%M")
print(f"{planned} | {line} → {dest} | Station: {station_name}")