diff --git a/music_assistant/common/models/config_entries.py b/music_assistant/common/models/config_entries.py index ae2c673ac..5824b6622 100644 --- a/music_assistant/common/models/config_entries.py +++ b/music_assistant/common/models/config_entries.py @@ -216,7 +216,8 @@ def update(self, update: dict[str, ConfigValueType]) -> set[str]: changed_keys.add(key) # config entry values - for key, new_val in update.items(): + values = update.get("values", update) + for key, new_val in values.items(): if key in root_values: continue cur_val = self.values[key].value if key in self.values else None diff --git a/music_assistant/server/controllers/config.py b/music_assistant/server/controllers/config.py index 78771d8fc..feefaa4cd 100644 --- a/music_assistant/server/controllers/config.py +++ b/music_assistant/server/controllers/config.py @@ -265,10 +265,16 @@ async def remove_provider_config(self, instance_id: str) -> None: if not existing: raise KeyError(f"Provider {instance_id} does not exist") prov_manifest = self.mass.get_provider_manifest(existing["domain"]) - if prov_manifest.load_by_default: - raise RuntimeError("Default provider can not be removed, use disable instead.") + if prov_manifest.load_by_default and instance_id == prov_manifest.domain: + # Guard for a provider that is loaded by default + LOGGER.warning( + "Provider %s can not be removed, disabling instead...", prov_manifest.name + ) + existing["enabled"] = False + await self._update_provider_config(instance_id, existing) + return if prov_manifest.builtin: - raise RuntimeError("Builtin provider can not be removed.") + raise RuntimeError(f"Builtin provider {prov_manifest.name} can not be removed.") self.remove(conf_key) await self.mass.unload_provider(instance_id) if existing["type"] == "music": @@ -640,7 +646,9 @@ async def _update_provider_config( await self.mass.unload_provider(config.instance_id) if config.type == ProviderType.PLAYER: # cleanup entries in player manager - for player in self.mass.players: + for player in self.mass.players.all( + return_unavailable=True, return_hidden=True, return_disabled=True + ): if player.provider != instance_id: continue self.mass.players.remove(player.player_id, cleanup_config=False)