From 027aeab96917c09ff7534e72ed296f4a265d32b2 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Sun, 1 Feb 2026 11:14:18 -0500 Subject: [PATCH] Fix compilation errors in favorite-to-keep and file cache features --- allstarr/Controllers/JellyfinController.cs | 23 ++++++++----------- .../Spotify/SpotifyMissingTracksFetcher.cs | 4 ++-- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs index 08687c0..62fbaf9 100644 --- a/allstarr/Controllers/JellyfinController.cs +++ b/allstarr/Controllers/JellyfinController.cs @@ -2110,23 +2110,18 @@ public class JellyfinController : ControllerBase return; } - // Check if file exists in downloads folder - var downloadPath = PathHelper.GetSongPath(song.Artist, song.Album, song.Title); - if (!System.IO.File.Exists(downloadPath)) + // Trigger download first + _logger.LogInformation("Downloading track for kept folder: {ItemId}", itemId); + var downloadResult = await _downloadService.DownloadSongAsync(provider, externalId); + + if (!downloadResult.IsSuccess) { - _logger.LogInformation("Track not yet downloaded, triggering download for {ItemId}", itemId); - - // Download the track first - var downloadResult = await _downloadService.DownloadSongAsync(provider, externalId); - if (!downloadResult.IsSuccess) - { - _logger.LogWarning("Failed to download track {ItemId}: {Error}", itemId, downloadResult.Error); - return; - } - - downloadPath = downloadResult.Value!.FilePath; + _logger.LogWarning("Failed to download track {ItemId}: {Error}", itemId, downloadResult.Error); + return; } + var downloadPath = downloadResult.Value!.FilePath; + // Create kept folder structure: /app/kept/Artist/Album/ var keptBasePath = "/app/kept"; var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist)); diff --git a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs index 4cb8057..1e04753 100644 --- a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs +++ b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs @@ -142,8 +142,8 @@ public class SpotifyMissingTracksFetcher : BackgroundService playlistName, fileAge.TotalHours); // Load from file into Redis if not already there - var cacheKey = $"spotify:missing:{playlistName}"; - if (!await _cache.ExistsAsync(cacheKey)) + var key = $"spotify:missing:{playlistName}"; + if (!await _cache.ExistsAsync(key)) { await LoadFromFileCache(playlistName); }