This commit is contained in:
1 parent
83a26c9476
commit
0c8672789d
11 files changed
+111
-120
No files matched your search
@@ -7,6 +7,7 @@ reports for your own devices.
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -58,29 +59,31 @@ except FileNotFoundError:
|
||||
"and fill in your own rooms (see the README's Configure section)."
|
||||
)
|
||||
|
||||
TARGETS = _cfg["targets"]
|
||||
ROOMS = _cfg["rooms"]
|
||||
|
||||
for _key, _target in TARGETS.items():
|
||||
_group = _target.get("in_room_group", "none")
|
||||
for _index, (_key, _room) in enumerate(ROOMS.items()):
|
||||
_group = _room.get("in_room_group", "none")
|
||||
if _group not in IN_ROOM_GROUPS:
|
||||
raise SystemExit(
|
||||
f"{_config_path}: '{_key}' has in_room_group '{_group}', not one "
|
||||
f"of {', '.join(IN_ROOM_GROUPS)}"
|
||||
)
|
||||
# No 'order' in config.json just means "wherever it falls in rooms".
|
||||
_room.setdefault("order", _index)
|
||||
|
||||
# The AVR is always the group host: its content takes over every room
|
||||
# that joins, which is the whole point of the merge buttons.
|
||||
HOST_KEY = _cfg["host_key"]
|
||||
HOST_ROOM = _cfg["host_room"]
|
||||
|
||||
# The rooms that get a card with volume + a join/leave button, in order.
|
||||
ROOM_KEYS = _cfg["room_keys"]
|
||||
# The rooms that get a card with volume + a join/leave button.
|
||||
GUEST_ROOMS = _cfg["guest_rooms"]
|
||||
|
||||
# The grid the volume buttons snap to. A tap moves to the next multiple of
|
||||
# this rather than adding it, so at 5 a level of 23 goes to 25, not 28.
|
||||
VOLUME_STEP = _cfg["volume_step"]
|
||||
|
||||
# Port the panel itself listens on.
|
||||
WEB_PORT = _cfg["web_port"]
|
||||
APP_PORT = _cfg["app_port"]
|
||||
|
||||
# --- Network ----------------------------------------------------------
|
||||
# Any ONE HEOS device's IP is enough: HEOS is a distributed system, so
|
||||
@@ -104,6 +107,23 @@ ZIDOO_INPUT_CODE = "inputs/mediaplayer" # see GET /api/avr/inputs
|
||||
# Shown as the app's name on the iOS home screen.
|
||||
APP_NAME = "Heos"
|
||||
|
||||
# The deployed commit, so the UI can tell when the Pi has moved on to a
|
||||
# newer version and reload itself -- iOS otherwise resumes a suspended
|
||||
# home-screen session without ever checking back with the server. Empty
|
||||
# when git isn't available; app.js treats that as "nothing to compare".
|
||||
def _app_version() -> str:
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "rev-parse", "--short", "HEAD"],
|
||||
cwd=Path(__file__).resolve().parent,
|
||||
capture_output=True, text=True, timeout=1,
|
||||
)
|
||||
return result.stdout.strip() if result.returncode == 0 else ""
|
||||
except OSError:
|
||||
return ""
|
||||
|
||||
APP_VERSION = _app_version()
|
||||
|
||||
# --- Spotify (optional) -------------------------------------------------
|
||||
# One Spotify button per account on each speaker's card (not the AVR's),
|
||||
# resuming that account's playback there -- see the README's Spotify section and
|
||||
|
||||
Reference in new issue
Block a user