Remove the Departures screen
Not needed any more -- the Journey screen already covers the same regional-transit need via EFA backends, and Departures depended on the free db-vendo-client API that DB has been actively blocking third parties from anyway. Removed screens/departures.py, its settings template, its route, its registration in screens/__init__.py, and its nav link. Reworded the docstring/hint references in journey.py and settings_journey.html that pointed at the now-gone screen. Existing config.json entries referencing "departures" (rotation list, pinned screen) are harmless leftovers -- both scheduler lookups already filter to screens that still exist, so nothing needs a migration step. Verified: app boots clean, /settings/departures 404s, every other settings page still loads fine, no leftover references outside of journey.py's own unrelated "departure time" wording.
This commit is contained in:
1 parent
5889422c31
commit
684d706afc
8 files changed
+6
-302
No files matched your search
-34
@@ -128,40 +128,6 @@ def create_app(config, screens: dict, scheduler) -> Flask:
|
||||
|
||||
return render_template("settings_weather.html", settings=config.get_screen_settings("weather"), error=error)
|
||||
|
||||
@app.route("/settings/departures", methods=["GET", "POST"])
|
||||
def settings_departures():
|
||||
error = None
|
||||
if request.method == "POST":
|
||||
station_query = request.form.get("station", "").strip()
|
||||
results = int(request.form.get("results", 5) or 5)
|
||||
if results not in (3, 5, 8):
|
||||
results = 5
|
||||
update_minutes = max(1, int(request.form.get("update_minutes", 2) or 2))
|
||||
|
||||
if station_query:
|
||||
try:
|
||||
found = screens["departures"].find_station(station_query)
|
||||
except requests.exceptions.RequestException:
|
||||
found = None
|
||||
if found is None:
|
||||
error = f'Could not find a station matching "{station_query}" -- try a different spelling, or the service might be temporarily down.'
|
||||
else:
|
||||
config.update_screen_settings("departures", {
|
||||
"station": station_query,
|
||||
"station_id": found["id"],
|
||||
"station_label": found["name"],
|
||||
"results": results,
|
||||
"update_minutes": update_minutes,
|
||||
})
|
||||
scheduler.invalidate_screen("departures")
|
||||
return redirect(url_for("settings_departures", found=found["name"]))
|
||||
else:
|
||||
config.update_screen_settings("departures", {"results": results, "update_minutes": update_minutes})
|
||||
scheduler.invalidate_screen("departures")
|
||||
return redirect(url_for("settings_departures", saved=1))
|
||||
|
||||
return render_template("settings_departures.html", settings=config.get_screen_settings("departures"), error=error)
|
||||
|
||||
@app.route("/settings/journey", methods=["GET", "POST"])
|
||||
def settings_journey():
|
||||
error = None
|
||||
|
||||
@@ -189,7 +189,6 @@
|
||||
<a href="{{ url_for('index') }}" class="{{ 'active' if request.endpoint == 'index' }}">Status</a>
|
||||
<a href="{{ url_for('settings_navidrome') }}" class="{{ 'active' if request.endpoint == 'settings_navidrome' }}">Navidrome</a>
|
||||
<a href="{{ url_for('settings_weather') }}" class="{{ 'active' if request.endpoint == 'settings_weather' }}">Weather</a>
|
||||
<a href="{{ url_for('settings_departures') }}" class="{{ 'active' if request.endpoint == 'settings_departures' }}">Departures</a>
|
||||
<a href="{{ url_for('settings_journey') }}" class="{{ 'active' if request.endpoint == 'settings_journey' }}">Journey</a>
|
||||
<a href="{{ url_for('settings_picture') }}" class="{{ 'active' if request.endpoint == 'settings_picture' }}">Picture</a>
|
||||
<a href="{{ url_for('settings_rotation') }}" class="{{ 'active' if request.endpoint == 'settings_rotation' }}">Rotation</a>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Departures</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;">
|
||||
Uses the free, unofficial db-vendo-client API (v6.db.transport.rest) --
|
||||
no key needed, but it's a community-run service, not official Deutsche
|
||||
Bahn infrastructure. Expect occasional downtime; the screen shows a plain
|
||||
"not available" message rather than breaking when that happens.
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<div class="card">
|
||||
<div class="section-label">Station</div>
|
||||
<div class="field">
|
||||
<label for="station">Station or stop name</label>
|
||||
<input type="text" id="station" name="station" placeholder="e.g. Berlin Hauptbahnhof">
|
||||
<p class="hint">Works for bus/tram/subway stops too, not just train stations -- search by name the same way either way.</p>
|
||||
{% if settings.station_label %}
|
||||
<p class="hint">Currently: {{ settings.station_label }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="section-label">Display</div>
|
||||
<div class="field">
|
||||
<label for="results">Departures to show</label>
|
||||
<select id="results" name="results">
|
||||
<option value="3" {{ "selected" if settings.results == 3 }}>3</option>
|
||||
<option value="5" {{ "selected" if settings.results == 5 or not settings.results }}>5</option>
|
||||
<option value="8" {{ "selected" if settings.results == 8 }}>8</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 }}">
|
||||
<p class="hint">Departure boards change often, so this defaults much shorter than Weather's -- but same rule applies: the panel only actually redraws when something in the list changed.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -13,8 +13,8 @@
|
||||
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.
|
||||
lately) -- several are tried in order, so this stays reliable even when
|
||||
one regional backend is down.
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
Reference in new issue
Block a user