mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-10-08 14:05:02 -04:00
fix: resolve circular dependency in download service resolution by defining IConcreteDownloadService
This commit is contained in:
5 files changed
+17
-10
No files matched your search
+4
-4
@@ -588,10 +588,10 @@ builder.Services.AddSingleton<IConcreteMetadataService>(sp =>
|
||||
sp.GetService<GenreEnrichmentService>()));
|
||||
|
||||
// 2. Concrete Download Services
|
||||
builder.Services.AddSingleton<IDownloadService, DeezerDownloadService>();
|
||||
builder.Services.AddSingleton<IDownloadService, QobuzDownloadService>();
|
||||
builder.Services.AddSingleton<IDownloadService, AppleMusicDownloadService>();
|
||||
builder.Services.AddSingleton<IDownloadService>(sp =>
|
||||
builder.Services.AddSingleton<IConcreteDownloadService, DeezerDownloadService>();
|
||||
builder.Services.AddSingleton<IConcreteDownloadService, QobuzDownloadService>();
|
||||
builder.Services.AddSingleton<IConcreteDownloadService, AppleMusicDownloadService>();
|
||||
builder.Services.AddSingleton<IConcreteDownloadService>(sp =>
|
||||
new SquidWTFDownloadService(
|
||||
sp.GetRequiredService<IHttpClientFactory>(),
|
||||
sp.GetRequiredService<IConfiguration>(),
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace allstarr.Services.Common;
|
||||
/// Implements common download logic, tracking, and metadata writing.
|
||||
/// Subclasses implement provider-specific download and authentication logic.
|
||||
/// </summary>
|
||||
public abstract class BaseDownloadService : IDownloadService
|
||||
public abstract class BaseDownloadService : IConcreteDownloadService
|
||||
{
|
||||
protected readonly IConfiguration Configuration;
|
||||
protected readonly ILocalLibraryService LocalLibraryService;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace allstarr.Services.Common;
|
||||
|
||||
public class MultiProviderDownloadService : IDownloadService
|
||||
{
|
||||
private readonly IEnumerable<IDownloadService> _allServices;
|
||||
private readonly IEnumerable<IConcreteDownloadService> _allServices;
|
||||
private readonly IMusicMetadataService _metadataService;
|
||||
private readonly ProviderStatusManager _statusManager;
|
||||
private readonly OdesliService _odesliService;
|
||||
@@ -195,14 +195,14 @@ public class MultiProviderDownloadService : IDownloadService
|
||||
|
||||
|
||||
public MultiProviderDownloadService(
|
||||
IEnumerable<IDownloadService> services,
|
||||
IEnumerable<IConcreteDownloadService> services,
|
||||
IEnumerable<IConcreteMetadataService> metadataServices,
|
||||
IMusicMetadataService metadataService,
|
||||
ProviderStatusManager statusManager,
|
||||
OdesliService odesliService,
|
||||
ILogger<MultiProviderDownloadService> logger)
|
||||
{
|
||||
_allServices = services.Where(s => s.GetType() != typeof(MultiProviderDownloadService)).ToList();
|
||||
_allServices = services.ToList();
|
||||
_allMetadataServices = metadataServices.ToList();
|
||||
_metadataService = metadataService;
|
||||
_statusManager = statusManager;
|
||||
|
||||
@@ -64,3 +64,10 @@ public interface IDownloadService
|
||||
/// </summary>
|
||||
Task<bool> IsAvailableAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marker interface to distinguish concrete download services from orchestrator services.
|
||||
/// </summary>
|
||||
public interface IConcreteDownloadService : IDownloadService
|
||||
{
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class PlaylistSyncService
|
||||
{
|
||||
private readonly IConcreteMetadataService _deezerMetadataService;
|
||||
private readonly IConcreteMetadataService _qobuzMetadataService;
|
||||
private readonly IEnumerable<IDownloadService> _downloadServices;
|
||||
private readonly IEnumerable<IConcreteDownloadService> _downloadServices;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly SubsonicSettings _subsonicSettings;
|
||||
private readonly ILogger<PlaylistSyncService> _logger;
|
||||
@@ -36,7 +36,7 @@ public class PlaylistSyncService
|
||||
|
||||
public PlaylistSyncService(
|
||||
IEnumerable<IConcreteMetadataService> metadataServices,
|
||||
IEnumerable<IDownloadService> downloadServices,
|
||||
IEnumerable<IConcreteDownloadService> downloadServices,
|
||||
IConfiguration configuration,
|
||||
IOptions<SubsonicSettings> subsonicSettings,
|
||||
ILogger<PlaylistSyncService> logger)
|
||||
|
||||
Reference in new issue
Block a user