This commit is contained in:
@@ -19,17 +19,12 @@ class _FakeAvr:
|
||||
{"code": "PHONO", "name": "Turntable"},
|
||||
]
|
||||
|
||||
def __init__(self, allowed_codes=()):
|
||||
self.allowed_codes = list(allowed_codes or [])
|
||||
def __init__(self):
|
||||
self.connected = True
|
||||
self._code = "MPLAY"
|
||||
|
||||
def inputs(self, refresh=False):
|
||||
sources = list(self.INPUTS)
|
||||
if self.allowed_codes:
|
||||
order = {code: i for i, code in enumerate(self.allowed_codes)}
|
||||
sources = sorted((s for s in sources if s["code"] in order), key=lambda s: order[s["code"]])
|
||||
return sources
|
||||
return list(self.INPUTS)
|
||||
|
||||
def name_for(self, code):
|
||||
return next((s["name"] for s in self.INPUTS if s["code"] == code), code)
|
||||
@@ -46,7 +41,7 @@ class _FakeAvr:
|
||||
class DemoController:
|
||||
def __init__(self, cfg):
|
||||
self.cfg = cfg
|
||||
self.avr = _FakeAvr(cfg.AVR_INPUT_CODES)
|
||||
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}
|
||||
@@ -71,7 +66,13 @@ class DemoController:
|
||||
"error": None}
|
||||
for key in self.cfg.ROOM_KEYS
|
||||
],
|
||||
"avr": {"connected": True, "inputs": self.avr.inputs(), "input": self.avr.current_input()},
|
||||
"avr": {
|
||||
"connected": True, "inputs": self.avr.inputs(), "input": self.avr.current_input(),
|
||||
# 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": None, "image": None}
|
||||
if self.avr.current_input()["code"] == "MPLAY" else None,
|
||||
},
|
||||
"heos_ok": True,
|
||||
"errors": [],
|
||||
"demo": True,
|
||||
|
||||
Reference in New Issue
Block a user