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.
60 lines
2.2 KiB
HTML
60 lines
2.2 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
<h1>Journey</h1>
|
|
|
|
{% if error %}
|
|
<div class="toast error">{{ error }}</div>
|
|
{% endif %}
|
|
{% if request.args.get('found') %}
|
|
<div class="toast">Found: {{ request.args.get('found') }}</div>
|
|
{% endif %}
|
|
|
|
<p class="hint" style="margin: -0.5rem 0 1.25rem;">
|
|
Next connections for a fixed route -- your daily commute, say. Uses
|
|
regional EFA transit-planner backends (not Deutsche Bahn's own
|
|
infrastructure, which has been actively blocking third-party access
|
|
lately) -- several are tried in order, so this can work even when the
|
|
Departures screen's DB-based source can't.
|
|
</p>
|
|
|
|
<form method="post">
|
|
<div class="card">
|
|
<div class="section-label">Route</div>
|
|
<div class="field">
|
|
<label for="origin">From</label>
|
|
<input type="text" id="origin" name="origin" placeholder="e.g. Münster Hauptbahnhof">
|
|
{% if settings.origin_label %}
|
|
<p class="hint">Currently: {{ settings.origin_label }}</p>
|
|
{% endif %}
|
|
</div>
|
|
<div class="field">
|
|
<label for="destination">To</label>
|
|
<input type="text" id="destination" name="destination" placeholder="e.g. Dortmund Hauptbahnhof">
|
|
{% if settings.destination_label %}
|
|
<p class="hint">Currently: {{ settings.destination_label }}</p>
|
|
{% endif %}
|
|
</div>
|
|
<p class="hint">Leave either field empty to keep what's already saved and just change the options below.</p>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="section-label">Display</div>
|
|
<div class="field">
|
|
<label for="results">Connections to show</label>
|
|
<select id="results" name="results">
|
|
<option value="1" {{ "selected" if settings.results == 1 }}>1</option>
|
|
<option value="2" {{ "selected" if settings.results == 2 }}>2</option>
|
|
<option value="3" {{ "selected" if settings.results == 3 or not settings.results }}>3</option>
|
|
<option value="5" {{ "selected" if settings.results == 5 }}>5</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label for="update_minutes">Update every (minutes)</label>
|
|
<input type="number" id="update_minutes" name="update_minutes" min="1" value="{{ settings.update_minutes or 2 }}">
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
{% endblock %}
|