Fix grouped AVR / room card + add movie info
Deploy HEOS panel / deploy (push) Successful in 25s

This commit is contained in:
2026-09-16 20:36:29 +02:00
parent 69476134f7
commit 532b48ad37
7 changed files with 316 additions and 123 deletions
+26 -1
View File
@@ -17,7 +17,7 @@ import argparse
import os
from functools import wraps
from flask import Flask, jsonify, render_template, request
from flask import Flask, jsonify, render_template, request, url_for
from werkzeug.middleware.proxy_fix import ProxyFix
import config
@@ -144,6 +144,18 @@ def _mark_spotify_accounts(rooms: list):
room["spotify_account"] = playing_on.get(_spotify_name(room["key"]))
def _link_zidoo_poster(avr: dict):
"""Point the AVR's now-playing cover at our own copy of the Zidoo's
poster: the panel is served over https, and the Zidoo only speaks plain
http, which a phone will not load into an https page."""
track = avr.get("now_playing")
if not track:
return
poster_id = track.pop("poster_id", None)
if poster_id is not None:
track["image"] = url_for("api_zidoo_poster", poster_id=poster_id)
# --- The UI -----------------------------------------------------------
@app.route("/")
def index():
@@ -177,9 +189,22 @@ def api_state():
# Demo rooms are not on anyone's real Spotify, so they bring their own account.
if not data.get("demo"):
_mark_spotify_accounts(data["rooms"])
_link_zidoo_poster(data["avr"])
return jsonify(data)
@app.get("/api/zidoo/poster/<int:poster_id>")
def api_zidoo_poster(poster_id):
"""A film's poster, fetched from the Zidoo on the phone's behalf -- see
_link_zidoo_poster()."""
zidoo = getattr(controller, "zidoo", None)
image = zidoo.poster(poster_id) if zidoo else None
if image is None:
return "", 404
body, mimetype = image
return app.response_class(body, mimetype=mimetype)
@app.get("/api/targets")
@handle_errors
def api_targets():