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.
This commit is contained in:
2026-02-05 10:07:57 -05:00
parent e91833ebbb
commit cb57b406c1

View File

@@ -884,12 +884,19 @@ public class SpotifyTrackMatchingService : BackgroundService
ExternalId = externalId ExternalId = externalId
}; };
matchedTracks.Add(new MatchedTrack var matchedTrack = new MatchedTrack
{ {
Position = spotifyTrack.Position, Position = spotifyTrack.Position,
SpotifyId = spotifyTrack.SpotifyId, SpotifyId = spotifyTrack.SpotifyId,
MatchedSong = externalSong 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}", _logger.LogInformation("✓ Using manual external mapping for {Title}: {Provider} {ExternalId}",
spotifyTrack.Title, provider, externalId); spotifyTrack.Title, provider, externalId);