Small fix for source switching
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 6 Nov 2025 00:22:17 +0000 (01:22 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 6 Nov 2025 00:22:17 +0000 (01:22 +0100)
music_assistant/controllers/players/player_controller.py

index 319bc88ed62b1e4df8c661ba9d976eb3c0d9bd4d..7ab5abf4f1542dfad0c795199dda86e828ee76c1 100644 (file)
@@ -2148,13 +2148,14 @@ class PlayerController(CoreController):
     ) -> None:
         """Handle playback/select of given plugin source on player."""
         plugin_source = plugin_prov.get_source()
-        if plugin_source.in_use_by and (current_player := self.get(plugin_source.in_use_by)):
+        if plugin_source.in_use_by and plugin_source.in_use_by != player.player_id:
             self.logger.debug(
                 "Plugin source %s is already in use by player %s, stopping playback there first.",
                 plugin_source.name,
-                current_player.display_name,
+                plugin_source.in_use_by,
             )
-            await self.cmd_stop(current_player.player_id)
+            with suppress(PlayerCommandFailed):
+                await self.cmd_stop(plugin_source.in_use_by)
         stream_url = await self.mass.streams.get_plugin_source_url(plugin_source, player.player_id)
         plugin_source.in_use_by = player.player_id
         # Call on_select callback if available