"""Minimal client for the Zidoo media player's own HTTP API The AVR only tells HEOS which of its inputs is selected, never what a device plugged into one is actually showing, so a Zidoo's "now playing" has to be asked for directly, over its own control API on port 9529. Its video player only answers getPlayStatus while a video is actually loaded -- with nothing playing, that route does not exist yet, which looks the same here as the box being off or unreachable. Both are simply "nothing to show" rather than an error: this is a nice-to-have on top of an AVR input, not something the rest of the panel depends on. """ import json import urllib.error import urllib.request class ZidooClient: def __init__(self, host, port=9529, timeout=1.5): self.base_url = f"http://{host}:{port}" self.timeout = timeout def now_playing(self): """{"song", "artist", "image"} for whatever video is loaded, in the same shape a room's now-playing card already expects -- or None.""" try: with urllib.request.urlopen( f"{self.base_url}/ZidooVideoPlay/getPlayStatus", timeout=self.timeout ) as response: payload = json.loads(response.read()) except (urllib.error.URLError, ValueError): return None if payload.get("status") != 200: return None title = (payload.get("video") or {}).get("title") if not title: return None return {"song": title, "artist": None, "image": None}