From 2842f1ff587273cc0f6e5ade0294375e512a9f68 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 29 Apr 2025 14:52:53 +0200 Subject: [PATCH] Fix: check for group player when doing sanity checks on player sync --- music_assistant/controllers/players.py | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/music_assistant/controllers/players.py b/music_assistant/controllers/players.py index cd8713b9..8d7a6087 100644 --- a/music_assistant/controllers/players.py +++ b/music_assistant/controllers/players.py @@ -799,19 +799,23 @@ class PlayerController(CoreController): if child_player.synced_to and child_player.synced_to == target_player: continue # already synced to this target - if child_player.group_childs and child_player.state != PlayerState.IDLE: - # guard edge case: childplayer is already a sync leader on its own - raise PlayerCommandFailed( - f"Player {child_player.name} is already synced with other players, " - "you need to ungroup it first before you can join it to another player.", - ) - if child_player.synced_to: - # player already synced to another player, ungroup first - self.logger.warning( - "Player %s is already synced to another player, ungrouping first", - child_player.name, - ) - await self.cmd_ungroup(child_player.player_id) + # perform some sanity checks on the child player + # if we're not joining a group player + if parent_player.provider != "player_group": + if child_player.group_childs and child_player.state != PlayerState.IDLE: + # guard edge case: childplayer is already a sync leader on its own + raise PlayerCommandFailed( + f"Player {child_player.name} is already synced with other players, " + "you need to ungroup it first before you can join it to another player.", + ) + if child_player.synced_to: + # player already synced to another player, ungroup first + self.logger.warning( + "Player %s is already synced to another player, ungrouping first", + child_player.name, + ) + await self.cmd_ungroup(child_player.player_id) + # power on the player if needed if not child_player.powered and child_player.power_control != PLAYER_CONTROL_NONE: await self.cmd_power(child_player.player_id, True, skip_update=True) -- 2.34.1