New screens/journey.py, ported and simplified from github.com/EiS94/db_info (a Home Assistant integration). Deliberately uses only the regional EFA (Elektronische Fahrplanauskunft) backends the reference project queries (VRR prioritized for NRW routes, falling back to Bavaria/BW instances) and drops its bahn.de-internal-API source entirely -- that's DB's own infrastructure, exactly the kind of thing DB has been actively blocking (see the Departures screen). EFA instances are run by regional transit authorities, not DB, so they aren't part of that clampdown. Also dropped the reference project's parallel async fetch-and-score-all-sources machinery for simple sequential fallback, matching this project's fully synchronous style. Verified against live VRR data for a real NRW route (Münster -> Dortmund): real trains, platforms, transfer counts, even a night bus connection. Caught a real bug during that live test: EFA returns UTC timestamps (Z suffix), and datetime.fromisoformat() parses that correctly into an aware datetime, but strftime() on an aware datetime prints its own stored hour/minute rather than converting to local time first -- everything displayed 2 hours behind (CEST is UTC+2), which looked like "next" departures had already left. Fixed by converting with astimezone() before formatting; re-verified live afterward that departures now correctly show after the query time. Settings: origin/destination resolved via Open-Meteo's free geocoding (same pattern as Weather's city field), how many connections to show (1/2/3/5), and its own configurable update interval.
20 lines
615 B
Python
20 lines
615 B
Python
from screens.clock import ClockScreen
|
|
from screens.departures import DeparturesScreen
|
|
from screens.journey import JourneyScreen
|
|
from screens.navidrome import NavidromeScreen
|
|
from screens.picture import PictureScreen
|
|
from screens.weather import WeatherScreen
|
|
|
|
SCREEN_CLASSES = {
|
|
ClockScreen.id: ClockScreen,
|
|
WeatherScreen.id: WeatherScreen,
|
|
DeparturesScreen.id: DeparturesScreen,
|
|
JourneyScreen.id: JourneyScreen,
|
|
PictureScreen.id: PictureScreen,
|
|
NavidromeScreen.id: NavidromeScreen,
|
|
}
|
|
|
|
|
|
def create_screens() -> dict:
|
|
return {screen_id: cls() for screen_id, cls in SCREEN_CLASSES.items()}
|