Set hard-coded rooms order in config file
Deploy HEOS panel / deploy (push) Failing after 49s

This commit is contained in:
franzz committed 2026-09-22 15:37:07 +02:00
1 parent 83a26c9476
commit 0c8672789d
11 files changed
+111 -120

No files matched your search

+17 -16
View File
@@ -44,14 +44,14 @@ spotify: dict = {} # account key -> SpotifyClient, configured accounts only
# controller.py's module docstring), so its API has no field that says how
# many units heos_name actually names -- that has to come from config.json's
# "in_room_group" instead (config.IN_ROOM_GROUPS). The AVR/speaker split
# needs no such flag: this app's own design always makes HOST_KEY the AVR
# and ROOM_KEYS plain speakers, so it is known before any HEOS call is made.
# needs no such flag: this app's own design always makes HOST_ROOM the AVR
# and GUEST_ROOMS plain speakers, so it is known before any HEOS call is made.
#
# "kind" is passed straight through to the template as-is (one of
# config.IN_ROOM_GROUPS, or "avr") -- which icon that draws is the
# interface's business, not ours: see ICONS in static/app.js.
def _room_meta(key: str, kind: str) -> dict:
return {"key": key, "kind": kind, **config.TARGETS[key]}
return {"key": key, "kind": kind, **config.ROOMS[key]}
def _build_spotify() -> dict:
@@ -104,9 +104,9 @@ def _payload() -> dict:
def _target_from(data: dict, field: str = "target") -> str:
key = data.get(field)
if not key:
raise ValueError(f"Missing '{field}'. Valid rooms: {', '.join(config.TARGETS)}")
if key not in config.TARGETS:
raise ValueError(f"Unknown room '{key}'. Valid rooms: {', '.join(config.TARGETS)}")
raise ValueError(f"Missing '{field}'. Valid rooms: {', '.join(config.ROOMS)}")
if key not in config.ROOMS:
raise ValueError(f"Unknown room '{key}'. Valid rooms: {', '.join(config.ROOMS)}")
return key
@@ -122,7 +122,7 @@ def _spotify_from(data: dict) -> SpotifyClient:
def _spotify_name(key: str) -> str:
target = config.TARGETS[key]
target = config.ROOMS[key]
return target.get("spotify_name", target["heos_name"])
@@ -234,7 +234,7 @@ def _release_over_heos(key: str):
inputs = controller.heos_inputs(key)
if not inputs:
raise ValueError(
f"'{config.TARGETS[key]['label']}' did not answer on the network, and HEOS lists "
f"'{config.ROOMS[key]['label']}' did not answer on the network, and HEOS lists "
"no input on it to fall back to -- so there is no way from here to take this room "
"off Spotify.")
# An AUX jack with nothing in it is the quietest thing a speaker can be
@@ -329,14 +329,14 @@ def _link_zidoo_poster(avr: dict):
# --- The UI -----------------------------------------------------------
@app.route("/")
def index():
host = _room_meta(config.HOST_ROOM, "avr")
rooms = {config.HOST_ROOM: host, **{key: _room_meta(key, config.ROOMS[key].get("in_room_group", "none")) for key in config.GUEST_ROOMS}}
return render_template(
"index.html",
app_name=config.APP_NAME,
host=_room_meta(config.HOST_KEY, "avr"),
rooms=[
_room_meta(key, config.TARGETS[key].get("in_room_group", "none"))
for key in config.ROOM_KEYS
],
version=config.APP_VERSION,
host=host,
rooms=sorted(rooms.values(), key=lambda room: room["order"]),
step=config.VOLUME_STEP,
spotify_accounts=[{"key": key, "label": config.SPOTIFY_ACCOUNTS[key]["label"]} for key in spotify],
)
@@ -360,6 +360,7 @@ def api_state():
if not data.get("demo"):
_mark_spotify_accounts(data["rooms"])
_link_zidoo_poster(data["avr"])
data["version"] = config.APP_VERSION
return jsonify(data)
@@ -433,7 +434,7 @@ def api_playback():
state = data.get("state")
if state is not None and state not in ("play", "pause", "stop"):
raise ValueError("'state' must be play, pause or stop -- or left out to toggle")
if key == config.HOST_KEY:
if key == config.HOST_ROOM:
if state == "stop":
raise ValueError("The AVR's card plays a device on one of its inputs, which can only "
"play or pause -- 'stop' is for a HEOS room")
@@ -465,7 +466,7 @@ def api_seek():
if data.get("position_ms") is None:
raise ValueError("Provide 'position_ms', where to jump to")
position = max(0, int(data["position_ms"]))
if key == config.HOST_KEY:
if key == config.HOST_ROOM:
controller.zidoo_seek(position)
else:
account = _spotify_playing_on().get(_spotify_name(key))
@@ -711,7 +712,7 @@ def legacy_avr_input():
def main():
global controller, spotify
parser = argparse.ArgumentParser(description="HEOS panel")
parser.add_argument("--port", type=int, default=config.WEB_PORT)
parser.add_argument("--port", type=int, default=config.APP_PORT)
parser.add_argument("--host", default="0.0.0.0",
help="0.0.0.0 so your phone can reach it directly; "
"127.0.0.1 to allow only a local reverse proxy")