From: Marcel van der Veldt Date: Sun, 22 Feb 2026 23:56:07 +0000 (+0100) Subject: Some minor tweaks to handling prevent-playback of airplay X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=b161314e8e9914f485f99ebfaeff22c52bd8afb9;p=music-assistant-server.git Some minor tweaks to handling prevent-playback of airplay --- diff --git a/music_assistant/controllers/players/helpers.py b/music_assistant/controllers/players/helpers.py index beb9183d..164bdabf 100644 --- a/music_assistant/controllers/players/helpers.py +++ b/music_assistant/controllers/players/helpers.py @@ -92,7 +92,7 @@ def handle_player_command[PlayerControllerT: "PlayerController", **P, R]( kwargs["player_id"] = protocol_parent.player_id else: args = (protocol_parent.player_id, *args[1:]) # type: ignore[assignment] - self.logger.info( + self.logger.debug( "Auto-resolved protocol player %s to linked parent %s for command %s", player_id, protocol_parent.player_id, diff --git a/music_assistant/providers/airplay/provider.py b/music_assistant/providers/airplay/provider.py index 372087bc..2b9214aa 100644 --- a/music_assistant/providers/airplay/provider.py +++ b/music_assistant/providers/airplay/provider.py @@ -313,18 +313,19 @@ class AirPlayProvider(PlayerProvider): # Cancel any pending debounced pause since prevent-playback takes precedence self.mass.cancel_timer(f"debounced_pause_{player_id}") # Ignore during stream transition (stale message from old CLI process) - if player._transitioning: + if player._transitioning or not player.stream: self.logger.debug("Ignoring prevent-playback during stream transition") - elif stream := player.stream: - stream.prevent_playback = True - if stream.session: - # send power off which will take care of stopping the stream - # and removing this player from any sync groups, etc. + else: + player.stream.prevent_playback = True + if player.stream.session: self.logger.debug( - "received prevent-playback from %s, powering off player", + "Prevent playback command detected for player %s", player.name, ) - self.mass.create_task(self.mass.players.cmd_power(player_id, False)) + if player.state.synced_to or player.state.group_members: + self.mass.create_task(self.mass.players.cmd_ungroup(player_id)) + else: + self.mass.create_task(player.stream.session.stop()) elif "device-prevent-playback=0" in path: # device reports that its ready for playback again if stream := player.stream: