From 8e41feaaded6ec167c094b55ee2e7bddf0104a3d Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Thu, 26 Mar 2026 14:15:20 -0700 Subject: [PATCH] Fix Navidrome playlist sync truncation, clarify discovery label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Navidrome fix: - createPlaylist and other write operations now use POST instead of GET. Large playlists (161+ tracks) exceeded URL length limits when all songId params were in the query string, causing silent truncation (e.g., only 6 of 161 tracks added). POST sends params as form body with no size limit. - Write operation timeout bumped to 30s (was 10s) - _WRITE_ENDPOINTS set defines which Subsonic endpoints use POST UX fix: - Mirrored playlist cards now show "161/161 discovered on Spotify" instead of just "161/161 discovered" — clarifies that discovery means metadata matching, not library ownership --- core/navidrome_client.py | 20 ++++++++++++++++++-- webui/static/script.js | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/navidrome_client.py b/core/navidrome_client.py index a4adba5e..e2530683 100644 --- a/core/navidrome_client.py +++ b/core/navidrome_client.py @@ -301,8 +301,19 @@ class NavidromeClient: 'f': 'json' # Response format } + # Subsonic endpoints that modify data — use POST to avoid URL length limits + _WRITE_ENDPOINTS = frozenset({ + 'createPlaylist', 'updatePlaylist', 'deletePlaylist', + 'star', 'unstar', 'scrobble', 'setRating', + 'createShare', 'updateShare', 'deleteShare', + 'createUser', 'updateUser', 'deleteUser', + 'createBookmark', 'deleteBookmark', + 'startScan', + }) + def _make_request(self, endpoint: str, params: Optional[Dict[str, Any]] = None) -> Optional[Dict[str, Any]]: - """Make authenticated request to Navidrome Subsonic API""" + """Make authenticated request to Navidrome Subsonic API. + Uses POST for write operations (avoids URL length limits with large playlists).""" if not self.base_url or not self.username: return None @@ -314,7 +325,12 @@ class NavidromeClient: auth_params.update(params) try: - response = requests.get(url, params=auth_params, timeout=10) + # Use POST for write operations to avoid URL length limits + # (e.g., createPlaylist with 161 songId params would exceed GET URL limits) + if endpoint in self._WRITE_ENDPOINTS: + response = requests.post(url, data=auth_params, timeout=30) + else: + response = requests.get(url, params=auth_params, timeout=10) response.raise_for_status() data = response.json() diff --git a/webui/static/script.js b/webui/static/script.js index 3d677323..f7978bf4 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -57586,7 +57586,8 @@ function renderMirroredCard(p, container) { let ratioHtml = ''; if (disc > 0) { const complete = disc >= tot; - ratioHtml = `${disc}/${tot} discovered`; + const srcName = typeof currentMusicSourceName !== 'undefined' ? currentMusicSourceName : 'metadata'; + ratioHtml = `${disc}/${tot} discovered on ${srcName}`; } const card = document.createElement('div');