Fix: Manual external mappings now work correctly for playback

Two critical fixes:
1. External songs from manual mappings now get proper IDs (ext-{provider}-song-{id})
   - Previously had no ID, causing 'dummy' errors in Jellyfin
   - Now follows same format as auto-matched external tracks

2. Admin UI now correctly shows manual external mappings as available
   - Previously showed as 'Missing' even after mapping
   - Now properly detects manual external mappings and shows provider badge

This fixes the 400 Bad Request errors when trying to play manually mapped tracks.
This commit is contained in:
2026-02-05 11:12:15 -05:00
parent 2155a287a5
commit dbeb060d52
2 changed files with 9 additions and 1 deletions

View File

@@ -607,7 +607,14 @@ public class AdminController : ControllerBase
// If not local, check if it's externally matched or missing // If not local, check if it's externally matched or missing
if (isLocal != true) if (isLocal != true)
{ {
if (matchedSpotifyIds.Contains(track.SpotifyId)) // Check if there's a manual external mapping
if (isManualMapping && manualMappingType == "external")
{
// Track has manual external mapping - it's available externally
isLocal = false;
// externalProvider already set above
}
else if (matchedSpotifyIds.Contains(track.SpotifyId))
{ {
// Track is externally matched (search succeeded) // Track is externally matched (search succeeded)
isLocal = false; isLocal = false;

View File

@@ -874,6 +874,7 @@ public class SpotifyTrackMatchingService : BackgroundService
// Create a matched track entry for the external mapping // Create a matched track entry for the external mapping
var externalSong = new Song var externalSong = new Song
{ {
Id = $"ext-{provider}-song-{externalId}", // CRITICAL: Set proper ID format
Title = spotifyTrack.Title, Title = spotifyTrack.Title,
Artist = spotifyTrack.PrimaryArtist, Artist = spotifyTrack.PrimaryArtist,
Album = spotifyTrack.Album, Album = spotifyTrack.Album,