Spotify: SPOTIFY key watches the Christian EDM 2026 playlist during services; hold, restart key and auto-fix play it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 10:05:09 -04:00
co-authored by Claude Opus 5.5
parent 7e15deec9e
commit 3bd140108e
6 changed files with 117 additions and 8 deletions
+25
View File
@@ -108,6 +108,31 @@ class TestChecks(unittest.TestCase):
self.assertEqual(tiles["hd1"]["x"], "HD1\n28h")
self.assertEqual(tiles["dante"]["x"], "DANTE\n19/19")
def test_spotify(self):
chk = next(c for t in CONFIG["tiles"] for c in t.get("checks", []) if c["type"] == "spotify")
s = self.snap
msg = lambda ctx=self.ctx: sp.check_spotify(chk, s, ctx)[0][1]
self.assertEqual(msg().level, sp.OK) # not read yet
s.spotify = {"running": False}
self.assertEqual(msg().msg, "SPOTIFY CLOSED")
self.assertEqual(msg({"now": WEDNESDAY}).level, sp.OK) # only during services
s.spotify = {"running": True, "state": "paused", "track": "spotify:track:a"}
self.assertEqual(msg().msg, "NOT PLAYING")
s.spotify["state"] = "playing"
s.spotify_tracks = {"spotify:track:a", "spotify:track:b"}
s.spotify_recent.extend(["spotify:track:x", "spotify:track:y"])
self.assertEqual(msg().level, sp.OK) # list incomplete: 2 unknown is fine
s.spotify_recent.append("spotify:track:z")
self.assertEqual(msg().msg, "WRONG PLAYLIST")
s.spotify_recent.append("spotify:track:a")
self.assertEqual(msg().level, sp.OK)
s.spotify_complete = True
s.spotify_recent.append("spotify:track:q")
self.assertEqual(msg().msg, "WRONG PLAYLIST") # full list: one unknown is enough
fix = CONFIG["fixes"][chk["fix"]]
self.assertIn(chk["playlist"], fix["run"])
self.assertIn(chk["fix"], CONFIG["auto_fix"]["fixes"])
def test_connection_states(self):
c = self.snap.conns["ATEM"]
c["category"], c["message"] = "error", "Network error: connect ETIMEDOUT 10.1.10.2:9910"