From 4f74b34b9ac6c8c19c319b2354caae0d87e64544 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Wed, 4 Feb 2026 23:31:30 -0500 Subject: [PATCH] Fix Spotify playlist track counts in client responses - Fixed UpdateSpotifyPlaylistCounts to use GetPlaylistByJellyfinId instead of GetPlaylistById - Fixed GetSpotifyPlaylistTracksOrderedAsync to use correct playlist config lookup - Added diagnostic logging for playlist config lookups - Removed test-websocket.html file This fixes the issue where Spotify playlists showed 0 tracks in playlist lists but worked correctly when accessed directly. --- allstarr/Controllers/JellyfinController.cs | 10 ++++- test-websocket.html | 50 ---------------------- 2 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 test-websocket.html diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs index ebbeda0..4c43812 100644 --- a/allstarr/Controllers/JellyfinController.cs +++ b/allstarr/Controllers/JellyfinController.cs @@ -2767,10 +2767,12 @@ public class JellyfinController : ControllerBase _logger.LogInformation("Found Spotify playlist: {Id}", playlistId); // This is a Spotify playlist - get the actual track count - var playlistConfig = _spotifySettings.GetPlaylistById(playlistId); + var playlistConfig = _spotifySettings.GetPlaylistByJellyfinId(playlistId); if (playlistConfig != null) { + _logger.LogInformation("Found playlist config for Jellyfin ID {JellyfinId}: {Name} (Spotify ID: {SpotifyId})", + playlistId, playlistConfig.Name, playlistConfig.Id); var playlistName = playlistConfig.Name; // Get matched external tracks (tracks that were successfully downloaded/matched) @@ -2859,6 +2861,10 @@ public class JellyfinController : ControllerBase } } } + else + { + _logger.LogWarning("No playlist config found for Jellyfin ID {JellyfinId} - skipping count update", playlistId); + } } } @@ -3422,7 +3428,7 @@ public class JellyfinController : ControllerBase // Build final track list based on playlist configuration // Local tracks position is configurable per-playlist - var playlistConfig = _spotifySettings.GetPlaylistById(playlistId); + var playlistConfig = _spotifySettings.GetPlaylistByJellyfinId(playlistId); var localTracksPosition = playlistConfig?.LocalTracksPosition ?? LocalTracksPosition.First; var finalTracks = new List(); diff --git a/test-websocket.html b/test-websocket.html deleted file mode 100644 index acee765..0000000 --- a/test-websocket.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - WebSocket Test - - -

Jellyfin WebSocket Test

-
Connecting...
-
- - - -