mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Fix compilation errors and remove unused code
This commit is contained in:
@@ -62,20 +62,6 @@ public class JellyfinController : ControllerBase
|
|||||||
{
|
{
|
||||||
throw new InvalidOperationException("JELLYFIN_URL environment variable is not set");
|
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
|
#region Search
|
||||||
@@ -1660,27 +1646,6 @@ public class JellyfinController : ControllerBase
|
|||||||
return await ProxyRequest("web/index.html");
|
return await ProxyRequest("web/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Intercepts playlist items requests to inject Spotify playlist tracks.
|
|
||||||
/// </summary>
|
|
||||||
[HttpGet("Playlists/{playlistId}/Items", Order = 1)]
|
|
||||||
[HttpGet("playlists/{playlistId}/items", Order = 1)]
|
|
||||||
public async Task<IActionResult> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Catch-all endpoint that proxies unhandled requests to Jellyfin transparently.
|
/// 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.
|
/// This route has the lowest priority and should only match requests that don't have SearchTerm.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class SpotifyMissingTracksFetcher : BackgroundService
|
|||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly RedisCacheService _cache;
|
private readonly RedisCacheService _cache;
|
||||||
private readonly ILogger<SpotifyMissingTracksFetcher> _logger;
|
private readonly ILogger<SpotifyMissingTracksFetcher> _logger;
|
||||||
private readonly JellyfinProxyService _proxyService;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private bool _hasRunOnce = false;
|
private bool _hasRunOnce = false;
|
||||||
private Dictionary<string, string> _playlistIdToName = new();
|
private Dictionary<string, string> _playlistIdToName = new();
|
||||||
|
|
||||||
@@ -23,14 +23,14 @@ public class SpotifyMissingTracksFetcher : BackgroundService
|
|||||||
IOptions<JellyfinSettings> jellyfinSettings,
|
IOptions<JellyfinSettings> jellyfinSettings,
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
RedisCacheService cache,
|
RedisCacheService cache,
|
||||||
JellyfinProxyService proxyService,
|
IServiceProvider serviceProvider,
|
||||||
ILogger<SpotifyMissingTracksFetcher> logger)
|
ILogger<SpotifyMissingTracksFetcher> logger)
|
||||||
{
|
{
|
||||||
_spotifySettings = spotifySettings;
|
_spotifySettings = spotifySettings;
|
||||||
_jellyfinSettings = jellyfinSettings;
|
_jellyfinSettings = jellyfinSettings;
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
_proxyService = proxyService;
|
_serviceProvider = serviceProvider;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,11 +111,14 @@ public class SpotifyMissingTracksFetcher : BackgroundService
|
|||||||
{
|
{
|
||||||
_playlistIdToName.Clear();
|
_playlistIdToName.Clear();
|
||||||
|
|
||||||
|
using var scope = _serviceProvider.CreateScope();
|
||||||
|
var proxyService = scope.ServiceProvider.GetRequiredService<JellyfinProxyService>();
|
||||||
|
|
||||||
foreach (var playlistId in _spotifySettings.Value.PlaylistIds)
|
foreach (var playlistId in _spotifySettings.Value.PlaylistIds)
|
||||||
{
|
{
|
||||||
try
|
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))
|
if (playlistInfo != null && playlistInfo.RootElement.TryGetProperty("Name", out var nameElement))
|
||||||
{
|
{
|
||||||
var name = nameElement.GetString() ?? "";
|
var name = nameElement.GetString() ?? "";
|
||||||
|
|||||||
Reference in New Issue
Block a user