From cb57b406c17ced3d4425c7b5c5239d4d6096a42f Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Thu, 5 Feb 2026 10:07:57 -0500 Subject: [PATCH] Fix: Manual external mappings now properly included in playlist cache The bug was in PreBuildPlaylistItemsCacheAsync - when a manual external mapping was found, it was added to matchedTracks but the code used 'continue' to skip to the next track WITHOUT adding it to finalItems. This meant external manual mappings were never included in the playlist cache that gets served to clients. The fix converts the external song to Jellyfin item format and adds it to finalItems before continuing, ensuring manual external mappings are properly included in the pre-built playlist cache. --- .../Services/Spotify/SpotifyTrackMatchingService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs index 27f9e39..24ca90f 100644 --- a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs +++ b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs @@ -884,12 +884,19 @@ public class SpotifyTrackMatchingService : BackgroundService ExternalId = externalId }; - matchedTracks.Add(new MatchedTrack + var matchedTrack = new MatchedTrack { Position = spotifyTrack.Position, SpotifyId = spotifyTrack.SpotifyId, MatchedSong = externalSong - }); + }; + + matchedTracks.Add(matchedTrack); + + // Convert external song to Jellyfin item format and add to finalItems + var externalItem = responseBuilder.ConvertSongToJellyfinItem(externalSong); + finalItems.Add(externalItem); + externalUsedCount++; _logger.LogInformation("✓ Using manual external mapping for {Title}: {Provider} {ExternalId}", spotifyTrack.Title, provider, externalId);