diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs
index fb2b24e..fa71b70 100644
--- a/allstarr/Controllers/JellyfinController.cs
+++ b/allstarr/Controllers/JellyfinController.cs
@@ -62,20 +62,6 @@ public class JellyfinController : ControllerBase
{
throw new InvalidOperationException("JELLYFIN_URL environment variable is not set");
}
-
- // Log Spotify Import configuration on first controller instantiation
- _logger.LogInformation("========================================");
- _logger.LogInformation("Spotify Import Configuration:");
- _logger.LogInformation(" Enabled: {Enabled}", _spotifySettings.Enabled);
- _logger.LogInformation(" Sync Time: {Hour}:{Minute:D2}", _spotifySettings.SyncStartHour, _spotifySettings.SyncStartMinute);
- _logger.LogInformation(" Sync Window: {Hours} hours", _spotifySettings.SyncWindowHours);
- _logger.LogInformation(" Configured Playlists: {Count}", _spotifySettings.Playlists.Count);
- foreach (var playlist in _spotifySettings.Playlists)
- {
- _logger.LogInformation(" - {Name} (SpotifyName: {SpotifyName}, Enabled: {Enabled})",
- playlist.Name, playlist.SpotifyName, playlist.Enabled);
- }
- _logger.LogInformation("========================================");
}
#region Search
@@ -1660,27 +1646,6 @@ public class JellyfinController : ControllerBase
return await ProxyRequest("web/index.html");
}
- ///
- /// Intercepts playlist items requests to inject Spotify playlist tracks.
- ///
- [HttpGet("Playlists/{playlistId}/Items", Order = 1)]
- [HttpGet("playlists/{playlistId}/items", Order = 1)]
- public async Task GetPlaylistItems(string playlistId)
- {
- _logger.LogInformation("========================================");
- _logger.LogInformation("=== GetPlaylistItems INTERCEPTED ===");
- _logger.LogInformation("PlaylistId: {PlaylistId}", playlistId);
- _logger.LogInformation("Spotify Import Enabled: {Enabled}", _spotifySettings.Enabled);
- _logger.LogInformation("Configured Playlists: {Count}", _spotifySettings.Playlists.Count);
- foreach (var p in _spotifySettings.Playlists)
- {
- _logger.LogInformation(" - {Name} (SpotifyName: {SpotifyName}, Enabled: {Enabled})",
- p.Name, p.SpotifyName, p.Enabled);
- }
- _logger.LogInformation("========================================");
- return await GetPlaylistTracks(playlistId);
- }
-
///
/// Catch-all endpoint that proxies unhandled requests to Jellyfin transparently.
/// This route has the lowest priority and should only match requests that don't have SearchTerm.
diff --git a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs
index e989d29..e4744b3 100644
--- a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs
+++ b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs
@@ -14,7 +14,7 @@ public class SpotifyMissingTracksFetcher : BackgroundService
private readonly IHttpClientFactory _httpClientFactory;
private readonly RedisCacheService _cache;
private readonly ILogger _logger;
- private readonly JellyfinProxyService _proxyService;
+ private readonly IServiceProvider _serviceProvider;
private bool _hasRunOnce = false;
private Dictionary _playlistIdToName = new();
@@ -23,14 +23,14 @@ public class SpotifyMissingTracksFetcher : BackgroundService
IOptions jellyfinSettings,
IHttpClientFactory httpClientFactory,
RedisCacheService cache,
- JellyfinProxyService proxyService,
+ IServiceProvider serviceProvider,
ILogger logger)
{
_spotifySettings = spotifySettings;
_jellyfinSettings = jellyfinSettings;
_httpClientFactory = httpClientFactory;
_cache = cache;
- _proxyService = proxyService;
+ _serviceProvider = serviceProvider;
_logger = logger;
}
@@ -111,11 +111,14 @@ public class SpotifyMissingTracksFetcher : BackgroundService
{
_playlistIdToName.Clear();
+ using var scope = _serviceProvider.CreateScope();
+ var proxyService = scope.ServiceProvider.GetRequiredService();
+
foreach (var playlistId in _spotifySettings.Value.PlaylistIds)
{
try
{
- var playlistInfo = await _proxyService.GetJsonAsync($"Items/{playlistId}", null, null);
+ var playlistInfo = await proxyService.GetJsonAsync($"Items/{playlistId}", null, null);
if (playlistInfo != null && playlistInfo.RootElement.TryGetProperty("Name", out var nameElement))
{
var name = nameElement.GetString() ?? "";