Handle takeover control of pluginsource
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 27 Oct 2025 21:08:46 +0000 (22:08 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 27 Oct 2025 21:08:46 +0000 (22:08 +0100)
music_assistant/controllers/streams.py

index 63851fe4cb617ad7e74ab361c61a4bb39fa3a8c8..1596de5cd8df0a31579cb7fd0783def235f72bbd 100644 (file)
@@ -1068,9 +1068,10 @@ class StreamsController(CoreController):
         plugin_prov: PluginProvider = self.mass.get_provider(plugin_source_id)
         plugin_source = plugin_prov.get_source()
         if plugin_source.in_use_by and plugin_source.in_use_by != player_id:
-            raise RuntimeError(
-                f"PluginSource plugin_source.name is already in use by {plugin_source.in_use_by}"
-            )
+            # kick out existing player using this source
+            plugin_source.in_use_by = player_id
+            await asyncio.sleep(0.5)  # give some time to the other player to stop
+
         self.logger.debug(
             "Start streaming PluginSource %s to %s using output format %s",
             plugin_source_id,