Fix manual switch reverting instantly, add weather forecast

- scheduler: "Show X now" was a true one-shot -- reverted on the very next
  5s tick, causing the flash-to-X-then-flash-back-to-clock behavior. Now
  pins for 5 minutes (still preemptable by Navidrome priority, which stays
  authoritative). Added a "Resume automatic" action/button and status
  display showing what's pinned and until when.
- weather: daily forecast strip (3/5/7 days, selectable in settings) below
  current conditions, via Open-Meteo's daily= params in the same request.
  Fixed a bad symbol choice along the way -- DejaVu Sans has no glyph for
  the partly-cloudy emoji, was rendering as a tofu box; swapped to the
  plain cloud symbol, verified glyph coverage for the whole WMO code table.
This commit is contained in:
Honey committed 2026-07-21 23:06:16 +02:00
1 parent bfe4616f20
commit a19a7ea49e
7 files changed
+147 -40

No files matched your search

+10
View File
@@ -36,6 +36,11 @@ def create_app(config, screens: dict, scheduler) -> Flask:
scheduler.request_switch(screen_id)
return redirect(url_for("index"))
@app.route("/actions/resume", methods=["POST"])
def resume_rotation():
scheduler.request_resume_rotation()
return redirect(url_for("index"))
@app.route("/settings/navidrome", methods=["GET", "POST"])
def settings_navidrome():
if request.method == "POST":
@@ -60,6 +65,9 @@ def create_app(config, screens: dict, scheduler) -> Flask:
city = request.form.get("city", "").strip()
lat_raw = request.form.get("latitude", "").strip()
lon_raw = request.form.get("longitude", "").strip()
forecast_days = int(request.form.get("forecast_days", 3) or 3)
if forecast_days not in (3, 5, 7):
forecast_days = 3
if city:
try:
@@ -73,6 +81,7 @@ def create_app(config, screens: dict, scheduler) -> Flask:
"city": result["label"],
"latitude": result["latitude"],
"longitude": result["longitude"],
"forecast_days": forecast_days,
})
return redirect(url_for("settings_weather", saved=1))
else:
@@ -80,6 +89,7 @@ def create_app(config, screens: dict, scheduler) -> Flask:
"city": "",
"latitude": float(lat_raw) if lat_raw else None,
"longitude": float(lon_raw) if lon_raw else None,
"forecast_days": forecast_days,
})
return redirect(url_for("settings_weather", saved=1))