Spotify: grey when closed or paused outside services
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -431,7 +431,7 @@ def check_spotify(chk, snap, ctx):
|
|||||||
return [("spotify", Result(OK))] # not read yet
|
return [("spotify", Result(OK))] # not read yet
|
||||||
state = "CLOSED" if not sp_.get("running") else (sp_.get("state") or "?").upper()
|
state = "CLOSED" if not sp_.get("running") else (sp_.get("state") or "?").upper()
|
||||||
if not in_windows(chk.get("windows", []), ctx["now"]):
|
if not in_windows(chk.get("windows", []), ctx["now"]):
|
||||||
return [("spotify", Result(OK, info=state))]
|
return [("spotify", Result(OK if state == "PLAYING" else OFF, info=state))] # grey when not playing
|
||||||
if not sp_.get("running"):
|
if not sp_.get("running"):
|
||||||
return [("spotify", Result(ERR, "SPOTIFY CLOSED", named=True))]
|
return [("spotify", Result(ERR, "SPOTIFY CLOSED", named=True))]
|
||||||
if state != "PLAYING":
|
if state != "PLAYING":
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class TestChecks(unittest.TestCase):
|
|||||||
self.assertEqual(msg().level, sp.OK) # not read yet
|
self.assertEqual(msg().level, sp.OK) # not read yet
|
||||||
s.spotify = {"running": False}
|
s.spotify = {"running": False}
|
||||||
self.assertEqual(msg().msg, "SPOTIFY CLOSED")
|
self.assertEqual(msg().msg, "SPOTIFY CLOSED")
|
||||||
self.assertEqual(msg({"now": WEDNESDAY}).level, sp.OK) # only during services
|
self.assertEqual(msg({"now": WEDNESDAY}).level, sp.OFF) # grey, not an alarm, outside services
|
||||||
s.spotify = {"running": True, "state": "paused", "track": "spotify:track:a"}
|
s.spotify = {"running": True, "state": "paused", "track": "spotify:track:a"}
|
||||||
self.assertEqual(msg().msg, "NOT PLAYING")
|
self.assertEqual(msg().msg, "NOT PLAYING")
|
||||||
s.spotify["state"] = "playing"
|
s.spotify["state"] = "playing"
|
||||||
|
|||||||
Reference in New Issue
Block a user