From dbeb060d523b5a020b0d7d2bf7f7cca72ce5389f Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Thu, 5 Feb 2026 11:12:15 -0500 Subject: [PATCH] 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. --- allstarr/Controllers/AdminController.cs | 9 ++++++++- allstarr/Services/Spotify/SpotifyTrackMatchingService.cs | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index bc3878b..073db61 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -607,7 +607,14 @@ public class AdminController : ControllerBase // If not local, check if it's externally matched or missing 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) isLocal = false; diff --git a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs index 24ca90f..dae7ddc 100644 --- a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs +++ b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs @@ -874,6 +874,7 @@ public class SpotifyTrackMatchingService : BackgroundService // Create a matched track entry for the external mapping var externalSong = new Song { + Id = $"ext-{provider}-song-{externalId}", // CRITICAL: Set proper ID format Title = spotifyTrack.Title, Artist = spotifyTrack.PrimaryArtist, Album = spotifyTrack.Album,