From: Marcel van der Veldt Date: Thu, 13 Jun 2024 16:49:36 +0000 (+0200) Subject: Fix pause on grouped airplay players X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=b625737f7de3eaaaffb2faedc9b9c2a8e84010e4;p=music-assistant-server.git Fix pause on grouped airplay players --- 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,