From b625737f7de3eaaaffb2faedc9b9c2a8e84010e4 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Thu, 13 Jun 2024 18:49:36 +0200 Subject: [PATCH] Fix pause on grouped airplay players --- .../server/providers/airplay/__init__.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/music_assistant/server/providers/airplay/__init__.py b/music_assistant/server/providers/airplay/__init__.py index 39c3f089..faf0f5c5 100644 --- a/music_assistant/server/providers/airplay/__init__.py +++ b/music_assistant/server/providers/airplay/__init__.py @@ -605,12 +605,18 @@ class AirplayProvider(PlayerProvider): - player_id: player_id of the player to handle the command. """ - # forward command to player and any connected sync members - async with asyncio.TaskGroup() as tg: - for airplay_player in self._get_sync_clients(player_id): - if airplay_player.active_stream and airplay_player.active_stream.running: - # prefer interactive command to our streamer - tg.create_task(airplay_player.active_stream.send_cli_command("ACTION=PAUSE")) + player = self.mass.players.get(player_id) + if player.synced_to: + # should not happen, but just in case + raise RuntimeError("Player is synced") + if player.group_childs: + # pause is not supported while synced, use stop instead + await self.cmd_stop(player_id) + return + airplay_player = self._players[player_id] + if airplay_player.active_stream and airplay_player.active_stream.running: + # prefer interactive command to our streamer + await airplay_player.active_stream.send_cli_command("ACTION=PAUSE") async def play_media( # noqa: PLR0915 self, -- 2.34.1