Fix compilation errors in favorite-to-keep and file cache features

This commit is contained in:
2026-02-01 11:14:18 -05:00
parent 449bcc2561
commit 027aeab969
2 changed files with 11 additions and 16 deletions

View File

@@ -2110,23 +2110,18 @@ public class JellyfinController : ControllerBase
return; return;
} }
// Check if file exists in downloads folder // Trigger download first
var downloadPath = PathHelper.GetSongPath(song.Artist, song.Album, song.Title); _logger.LogInformation("Downloading track for kept folder: {ItemId}", itemId);
if (!System.IO.File.Exists(downloadPath)) var downloadResult = await _downloadService.DownloadSongAsync(provider, externalId);
if (!downloadResult.IsSuccess)
{ {
_logger.LogInformation("Track not yet downloaded, triggering download for {ItemId}", itemId); _logger.LogWarning("Failed to download track {ItemId}: {Error}", itemId, downloadResult.Error);
return;
// 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;
} }
var downloadPath = downloadResult.Value!.FilePath;
// Create kept folder structure: /app/kept/Artist/Album/ // Create kept folder structure: /app/kept/Artist/Album/
var keptBasePath = "/app/kept"; var keptBasePath = "/app/kept";
var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist)); var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist));

View File

@@ -142,8 +142,8 @@ public class SpotifyMissingTracksFetcher : BackgroundService
playlistName, fileAge.TotalHours); playlistName, fileAge.TotalHours);
// Load from file into Redis if not already there // Load from file into Redis if not already there
var cacheKey = $"spotify:missing:{playlistName}"; var key = $"spotify:missing:{playlistName}";
if (!await _cache.ExistsAsync(cacheKey)) if (!await _cache.ExistsAsync(key))
{ {
await LoadFromFileCache(playlistName); await LoadFromFileCache(playlistName);
} }