From 629e95ac305710aaac3302749b3cdd6b86818ba0 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Thu, 5 Feb 2026 11:38:26 -0500 Subject: [PATCH] Improve logging: clarify search vs manual mappings, show manual mapping counts in final log --- .../Spotify/SpotifyTrackMatchingService.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs index 05ab695..5f624f6 100644 --- a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs +++ b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs @@ -483,7 +483,7 @@ public class SpotifyTrackMatchingService : BackgroundService await _cache.SetAsync(legacyKey, legacySongs, TimeSpan.FromHours(1)); _logger.LogInformation( - "✓ Cached {Matched}/{Total} tracks for {Playlist} (ISRC: {Isrc}, Fuzzy: {Fuzzy}, No match: {NoMatch})", + "✓ Cached {Matched}/{Total} tracks for {Playlist} via search (ISRC: {Isrc}, Fuzzy: {Fuzzy}, No match: {NoMatch}) - manual mappings will be applied next", matchedTracks.Count, tracksToMatch.Count, playlistName, isrcMatches, fuzzyMatches, noMatch); // Pre-build playlist items cache for instant serving @@ -805,6 +805,8 @@ public class SpotifyTrackMatchingService : BackgroundService var usedJellyfinItems = new HashSet(); var localUsedCount = 0; var externalUsedCount = 0; + var manualLocalCount = 0; + var manualExternalCount = 0; foreach (var spotifyTrack in spotifyTracks.OrderBy(t => t.Position)) { @@ -828,6 +830,7 @@ public class SpotifyTrackMatchingService : BackgroundService if (itemStatusCode == 200 && itemResponse != null) { matchedJellyfinItem = itemResponse.RootElement; + manualLocalCount++; _logger.LogDebug("✓ Using manual Jellyfin mapping for {Title}: Jellyfin ID {Id}", spotifyTrack.Title, manualJellyfinId); } @@ -927,6 +930,7 @@ public class SpotifyTrackMatchingService : BackgroundService var externalItem = responseBuilder.ConvertSongToJellyfinItem(externalSong); finalItems.Add(externalItem); externalUsedCount++; + manualExternalCount++; _logger.LogInformation("✓ Using manual external mapping for {Title}: {Provider} {ExternalId}", spotifyTrack.Title, provider, externalId); @@ -1007,9 +1011,15 @@ public class SpotifyTrackMatchingService : BackgroundService // Save to file cache for persistence await SavePlaylistItemsToFileAsync(playlistName, finalItems); + var manualMappingInfo = ""; + if (manualLocalCount > 0 || manualExternalCount > 0) + { + manualMappingInfo = $" [Manual: {manualLocalCount} local, {manualExternalCount} external]"; + } + _logger.LogInformation( - "✅ Pre-built playlist cache for {Playlist}: {Total} tracks ({Local} LOCAL + {External} EXTERNAL)", - playlistName, finalItems.Count, localUsedCount, externalUsedCount); + "✅ Pre-built playlist cache for {Playlist}: {Total} tracks ({Local} LOCAL + {External} EXTERNAL){ManualInfo}", + playlistName, finalItems.Count, localUsedCount, externalUsedCount, manualMappingInfo); } else {