Fix AVR playing state
Deploy HEOS panel / deploy (push) Successful in 25s

This commit is contained in:
2026-09-16 20:39:53 +02:00
parent 532b48ad37
commit 51dff45b54
4 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class DemoController:
# Standing in for a Zidoo plugged into this input, so the # Standing in for a Zidoo plugged into this input, so the
# AVR card's now-playing block has something to show here too. # AVR card's now-playing block has something to show here too.
"now_playing": {"song": "Big Buck Bunny", "artist": "2008", "image": None, "now_playing": {"song": "Big Buck Bunny", "artist": "2008", "image": None,
"position_ms": 241000, "duration_ms": 596000} "play_state": "play", "position_ms": 241000, "duration_ms": 596000}
if self.avr.current_input()["code"] == self.cfg.ZIDOO_INPUT_CODE else None, if self.avr.current_input()["code"] == self.cfg.ZIDOO_INPUT_CODE else None,
}, },
"heos_ok": True, "heos_ok": True,
+5 -5
View File
@@ -263,11 +263,11 @@ function paintGrouping() {
ui.joined.hidden = inside.length === 0; ui.joined.hidden = inside.length === 0;
// Grouped rooms share the host's transport, so one of them playing means // Grouped rooms share the host's transport, so one of them playing means
// the whole group is -- and the tint goes on the group's card. // the whole group is -- and the tint goes on the group's card.
const groupPlaying = inside.some((node) => node.classList.contains('playing')); // A film running on the Zidoo counts as the AVR playing too, grouped rooms or not.
ui.source.classList.toggle('playing', groupPlaying); const playing = inside.some((node) => node.classList.contains('playing'))
// A film on the Zidoo also moves the AVR up. The Zidoo does not say whether || avrNowPlaying?.play_state === 'play';
// it is paused, so a loaded film counts, and it gets no tint. ui.source.classList.toggle('playing', playing);
ui.source.classList.toggle('on-top', groupPlaying || Boolean(avrNowPlaying)); ui.source.classList.toggle('on-top', playing);
} }
/* Press and hold to keep moving, accelerating as you hold. */ /* Press and hold to keep moving, accelerating as you hold. */
+5 -1
View File
@@ -73,9 +73,13 @@ class ZidooTest(unittest.TestCase):
def test_a_film_carries_its_year_progress_and_poster(self): def test_a_film_carries_its_year_progress_and_poster(self):
self.assertEqual(self.zidoo.now_playing(), { self.assertEqual(self.zidoo.now_playing(), {
"song": "A Private War", "artist": "2018", "image": None, "poster_id": 108, "song": "A Private War", "artist": "2018", "image": None, "poster_id": 108,
"position_ms": 1589745, "duration_ms": 6635092, "play_state": "play", "position_ms": 1589745, "duration_ms": 6635092,
}) })
def test_a_paused_film_is_still_there_but_paused(self):
FakeZidoo.video["status"] = 0
self.assertEqual(self.zidoo.now_playing()["play_state"], "pause")
def test_the_poster_is_looked_up_once_per_file(self): def test_the_poster_is_looked_up_once_per_file(self):
self.zidoo.now_playing() self.zidoo.now_playing()
self.zidoo.now_playing() self.zidoo.now_playing()
+5 -2
View File
@@ -45,7 +45,9 @@ class ZidooClient:
instead. "image" is always None: the poster lives on the Zidoo, which instead. "image" is always None: the poster lives on the Zidoo, which
the phone cannot load over plain http, so "poster_id" names it the phone cannot load over plain http, so "poster_id" names it
instead for app.py to serve. "position_ms" and "duration_ms" come instead for app.py to serve. "position_ms" and "duration_ms" come
along whenever the length is known, as a room's do.""" along whenever the length is known, as a room's do. "play_state" is
"play" while the film runs (the video's "status" is 1), "pause"
otherwise."""
payload = self._get_json("ZidooVideoPlay/getPlayStatus") payload = self._get_json("ZidooVideoPlay/getPlayStatus")
if not payload or payload.get("status") != 200: if not payload or payload.get("status") != 200:
return None return None
@@ -56,7 +58,8 @@ class ZidooClient:
film = self._film(video.get("path")) film = self._film(video.get("path"))
year = film.get("year") year = film.get("year")
track = {"song": title, "artist": str(year) if year else None, "image": None, track = {"song": title, "artist": str(year) if year else None, "image": None,
"poster_id": film.get("id")} "poster_id": film.get("id"),
"play_state": "play" if video.get("status") == 1 else "pause"}
if video.get("duration"): if video.get("duration"):
track["position_ms"] = video.get("currentPosition") or 0 track["position_ms"] = video.get("currentPosition") or 0
track["duration_ms"] = video["duration"] track["duration_ms"] = video["duration"]