diff --git a/core/video/sources.py b/core/video/sources.py index 251ca5c7..477fe13a 100644 --- a/core/video/sources.py +++ b/core/video/sources.py @@ -92,12 +92,10 @@ def resolve_video_server(db=None): return "plex" if pref == "jellyfin" and jelly_ok: return "jellyfin" - - active = config_manager.get_active_media_server() - if active == "plex" and plex_ok: - return "plex" - if active == "jellyfin" and jelly_ok: - return "jellyfin" + # Fully INDEPENDENT of the music 'active server' — only an explicit video pick + # or the configured server(s) decide, so changing the music server NEVER + # changes video (and vice-versa). Auto-pick the single configured one; default + # to Plex when both are set (the user picks Jellyfin via the Video Source panel). if plex_ok and not jelly_ok: return "plex" if jelly_ok and not plex_ok: diff --git a/tests/test_video_server_resolution.py b/tests/test_video_server_resolution.py index 697e1667..1d5915f4 100644 --- a/tests/test_video_server_resolution.py +++ b/tests/test_video_server_resolution.py @@ -47,6 +47,15 @@ def test_independent_of_music_active(monkeypatch, vdb): def test_both_configured_default_then_explicit_pick(monkeypatch, vdb): _set_cm(monkeypatch, True, True, "plex") - assert resolve_video_server(vdb) == "plex" # falls back to the active one + assert resolve_video_server(vdb) == "plex" # both → Plex default vdb.set_setting("video_server", "jellyfin") assert resolve_video_server(vdb) == "jellyfin" # explicit video pick wins + + +def test_does_not_follow_music_active_server(monkeypatch, vdb): + # Both configured + music set to Jellyfin, but NO explicit video pick → video + # stays on Plex. Changing the music server must never change video. + _set_cm(monkeypatch, True, True, "jellyfin") + assert resolve_video_server(vdb) == "plex" + vdb.set_setting("video_server", "jellyfin") # only an explicit pick switches video + assert resolve_video_server(vdb) == "jellyfin" diff --git a/webui/static/settings.js b/webui/static/settings.js index d7503ca0..e4b7711f 100644 --- a/webui/static/settings.js +++ b/webui/static/settings.js @@ -2867,6 +2867,11 @@ function _getTagConfig(path) { } async function saveSettings(quiet = false) { + // ISOLATION: this saves MUSIC settings (and persists active_media_server from + // the shared server toggle). The video side reuses this page but must never + // write music config — it saves via /api/video/* only. So never run here while + // on the video side, no matter what triggered it (auto-save OR manual). + if (document.body.getAttribute('data-side') === 'video') return; // Validate file organization templates before saving const validationErrors = validateFileOrganizationTemplates(); if (validationErrors.length > 0) {