This commit is contained in:
1 parent
83a26c9476
commit
0c8672789d
11 files changed
+111
-120
No files matched your search
@@ -52,11 +52,11 @@ class DemoController:
|
||||
self.cfg = cfg
|
||||
self.avr = _FakeAvr()
|
||||
self.heos = None
|
||||
self._volume = {key: 22 + 7 * i for i, key in enumerate(cfg.TARGETS)}
|
||||
self._play = {key: "play" for key in cfg.TARGETS}
|
||||
self._volume = {key: 22 + 7 * i for i, key in enumerate(cfg.ROOMS)}
|
||||
self._play = {key: "play" for key in cfg.ROOMS}
|
||||
self._joined = set()
|
||||
# One room on Spotify and one not, so both kinds of card show up.
|
||||
self._spotify = {key: i == 0 for i, key in enumerate(cfg.ROOM_KEYS)}
|
||||
self._spotify = {key: i == 0 for i, key in enumerate(cfg.GUEST_ROOMS)}
|
||||
# No cover, since the demo has no network to fetch one from.
|
||||
self._track = {"song": "Harvest Moon", "artist": "Neil Young", "image": None}
|
||||
# Its play button only shows for a stream one of your accounts plays.
|
||||
@@ -67,19 +67,19 @@ class DemoController:
|
||||
# -- what the UI uses ---------------------------------------------
|
||||
def state(self):
|
||||
return {
|
||||
"host": {"key": self.cfg.HOST_KEY, "label": self.cfg.TARGETS[self.cfg.HOST_KEY]["label"]},
|
||||
"host": {"key": self.cfg.HOST_ROOM, "label": self.cfg.ROOMS[self.cfg.HOST_ROOM]["label"]},
|
||||
"rooms": [
|
||||
{"key": key, "label": self.cfg.TARGETS[key]["label"], "available": True,
|
||||
{"key": key, "label": self.cfg.ROOMS[key]["label"], "available": True,
|
||||
"grouped": key in self._joined, "volume": self._volume[key],
|
||||
"play_state": self._play[key], "spotify": self._spotify[key],
|
||||
"spotify_account": self._account if self._spotify[key] else None,
|
||||
"now_playing": self._track if self._spotify[key] and self._play[key] != "stop" else None,
|
||||
"error": None}
|
||||
for key in self.cfg.ROOM_KEYS
|
||||
for key in self.cfg.GUEST_ROOMS
|
||||
],
|
||||
"avr": {
|
||||
"connected": True, "inputs": self.avr.inputs(), "input": self.avr.current_input(),
|
||||
"volume": self._volume[self.cfg.HOST_KEY],
|
||||
"volume": self._volume[self.cfg.HOST_ROOM],
|
||||
# Standing in for a Zidoo plugged into this input, so the
|
||||
# AVR card's now-playing block has something to show here too.
|
||||
"now_playing": {"song": "Big Buck Bunny", "artist": "2008", "image": None,
|
||||
@@ -126,7 +126,7 @@ class DemoController:
|
||||
return self.joined_keys()
|
||||
|
||||
def set_membership(self, joined):
|
||||
self._joined = {k for k in self.cfg.ROOM_KEYS if k in joined}
|
||||
self._joined = {k for k in self.cfg.GUEST_ROOMS if k in joined}
|
||||
return self.joined_keys()
|
||||
|
||||
def zidoo_play_state(self, state=None):
|
||||
@@ -141,13 +141,13 @@ class DemoController:
|
||||
self._film_ms = min(596000, int(position_ms))
|
||||
|
||||
def joined_keys(self):
|
||||
return [k for k in self.cfg.ROOM_KEYS if k in self._joined]
|
||||
return [k for k in self.cfg.GUEST_ROOMS if k in self._joined]
|
||||
|
||||
# -- enough of the rest to keep the legacy routes answering --------
|
||||
def scan(self):
|
||||
return {
|
||||
"players": [{"name": t["heos_name"], "pid": 1000 + i, "model": "Demo"}
|
||||
for i, t in enumerate(self.cfg.TARGETS.values())],
|
||||
for i, t in enumerate(self.cfg.ROOMS.values())],
|
||||
"groups": [],
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user