From 27215384ddeec2e8e95bf3fafb4257c98c87d6a9 Mon Sep 17 00:00:00 2001 From: Toby Scholz Date: Sun, 15 Mar 2026 15:26:00 -0400 Subject: [PATCH] Fixed Playing and Pausing when in mode internet radio --- afsapi/api.py | 12 ++++++++++++ afsapi/models.py | 1 + 2 files changed, 13 insertions(+) diff --git a/afsapi/api.py b/afsapi/api.py index 21c7b3c..78e521d 100644 --- a/afsapi/api.py +++ b/afsapi/api.py @@ -519,18 +519,30 @@ async def play_control(self, value: t.Union[PlayControl, int]) -> t.Optional[boo async def play(self) -> t.Optional[bool]: """Play media.""" + mode = await self.get_mode() + if mode.label == "Internet radio": + return await self.play_control(PlayControl.STOP) return await self.play_control(PlayControl.PLAY) async def pause(self) -> t.Optional[bool]: """Pause playing.""" + mode = await self.get_mode() + if mode.label == "Internet radio": + return await self.play_control(PlayControl.STOP) return await self.play_control(PlayControl.PAUSE) async def forward(self) -> t.Optional[bool]: """Next media.""" + mode = await self.get_mode() + if mode.label == "Internet radio": + return None #Not supported return await self.play_control(PlayControl.NEXT) async def rewind(self) -> t.Optional[bool]: """Previous media.""" + mode = await self.get_mode() + if mode.label == "Internet radio": + return None #Not supported return await self.play_control(PlayControl.PREV) async def get_equalisers(self) -> t.List[Equaliser]: diff --git a/afsapi/models.py b/afsapi/models.py index e87c543..f341f61 100644 --- a/afsapi/models.py +++ b/afsapi/models.py @@ -11,6 +11,7 @@ class PlayState(IntEnum): class PlayControl(IntEnum): + STOP = 0 PLAY = 1 PAUSE = 2 NEXT = 3