@@ -36,6 +36,19 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
|
||||
controller: Controller = None
|
||||
spotify: dict = {} # account key -> SpotifyClient, configured accounts only
|
||||
|
||||
# HEOS merges any In-Room Group into one player at the hardware level (see
|
||||
# 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.
|
||||
#
|
||||
# "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]}
|
||||
|
||||
|
||||
def _build_spotify() -> dict:
|
||||
if not (config.SPOTIFY_CLIENT_ID and config.SPOTIFY_CLIENT_SECRET):
|
||||
@@ -137,8 +150,11 @@ def index():
|
||||
return render_template(
|
||||
"index.html",
|
||||
app_name=config.APP_NAME,
|
||||
host={"key": config.HOST_KEY, **config.TARGETS[config.HOST_KEY]},
|
||||
rooms=[{"key": key, **config.TARGETS[key]} for key in config.ROOM_KEYS],
|
||||
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
|
||||
],
|
||||
step=config.VOLUME_STEP,
|
||||
spotify_accounts=[{"key": key, "label": config.SPOTIFY_ACCOUNTS[key]["label"]} for key in spotify],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user