From 542616fa29aa53b585b0dd733e46f6454b8e2974 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 23 Feb 2026 23:04:41 +0100 Subject: [PATCH] Fix issue with saving player config not sticking default values --- music_assistant/controllers/config.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/music_assistant/controllers/config.py b/music_assistant/controllers/config.py index f5528ffe..8b48e9f3 100644 --- a/music_assistant/controllers/config.py +++ b/music_assistant/controllers/config.py @@ -810,17 +810,15 @@ class ConfigController: # store updated config first (to prevent issues with enabling/disabling players) conf_key = f"{CONF_PLAYERS}/{player_id}" # Get existing raw config to preserve values that don't have config entries. - # This can happen when config entries are dynamic (e.g., protocol settings depend on - # player.available and linked protocols). If save_player_config is called before - # the player is fully available, those entries won't exist and their stored values - # would be lost without this preservation. + # e.g. protocol links etc. existing_raw = self.get(conf_key) or {} existing_values = existing_raw.get("values", {}) new_raw = config.to_raw() new_values = new_raw.get("values", {}) - # Preserve values from storage that don't have config entries in current context + # Preserve values from storage that don't have config entries in current context. + config_entry_keys = set(config.values.keys()) for key, value in existing_values.items(): - if key not in new_values: + if key not in new_values and key not in config_entry_keys: new_values[key] = value new_raw["values"] = new_values self.set(conf_key, new_raw) -- 2.34.1