diff --git a/allstarr/Program.cs b/allstarr/Program.cs index 9cc61cc2..349ee136 100644 --- a/allstarr/Program.cs +++ b/allstarr/Program.cs @@ -588,10 +588,10 @@ builder.Services.AddSingleton(sp => sp.GetService())); // 2. Concrete Download Services -builder.Services.AddSingleton(); -builder.Services.AddSingleton(); -builder.Services.AddSingleton(); -builder.Services.AddSingleton(sp => +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(sp => new SquidWTFDownloadService( sp.GetRequiredService(), sp.GetRequiredService(), diff --git a/allstarr/Services/Common/BaseDownloadService.cs b/allstarr/Services/Common/BaseDownloadService.cs index c0663ac9..41a20cf6 100644 --- a/allstarr/Services/Common/BaseDownloadService.cs +++ b/allstarr/Services/Common/BaseDownloadService.cs @@ -16,7 +16,7 @@ namespace allstarr.Services.Common; /// Implements common download logic, tracking, and metadata writing. /// Subclasses implement provider-specific download and authentication logic. /// -public abstract class BaseDownloadService : IDownloadService +public abstract class BaseDownloadService : IConcreteDownloadService { protected readonly IConfiguration Configuration; protected readonly ILocalLibraryService LocalLibraryService; diff --git a/allstarr/Services/Common/MultiProviderDownloadService.cs b/allstarr/Services/Common/MultiProviderDownloadService.cs index 1b5d44db..c0895519 100644 --- a/allstarr/Services/Common/MultiProviderDownloadService.cs +++ b/allstarr/Services/Common/MultiProviderDownloadService.cs @@ -6,7 +6,7 @@ namespace allstarr.Services.Common; public class MultiProviderDownloadService : IDownloadService { - private readonly IEnumerable _allServices; + private readonly IEnumerable _allServices; private readonly IMusicMetadataService _metadataService; private readonly ProviderStatusManager _statusManager; private readonly OdesliService _odesliService; @@ -195,14 +195,14 @@ public class MultiProviderDownloadService : IDownloadService public MultiProviderDownloadService( - IEnumerable services, + IEnumerable services, IEnumerable metadataServices, IMusicMetadataService metadataService, ProviderStatusManager statusManager, OdesliService odesliService, ILogger logger) { - _allServices = services.Where(s => s.GetType() != typeof(MultiProviderDownloadService)).ToList(); + _allServices = services.ToList(); _allMetadataServices = metadataServices.ToList(); _metadataService = metadataService; _statusManager = statusManager; diff --git a/allstarr/Services/IDownloadService.cs b/allstarr/Services/IDownloadService.cs index d9a44070..46cd3473 100644 --- a/allstarr/Services/IDownloadService.cs +++ b/allstarr/Services/IDownloadService.cs @@ -64,3 +64,10 @@ public interface IDownloadService /// Task IsAvailableAsync(); } + +/// +/// Marker interface to distinguish concrete download services from orchestrator services. +/// +public interface IConcreteDownloadService : IDownloadService +{ +} diff --git a/allstarr/Services/Subsonic/PlaylistSyncService.cs b/allstarr/Services/Subsonic/PlaylistSyncService.cs index ea62bbbf..de93e0a4 100644 --- a/allstarr/Services/Subsonic/PlaylistSyncService.cs +++ b/allstarr/Services/Subsonic/PlaylistSyncService.cs @@ -16,7 +16,7 @@ public class PlaylistSyncService { private readonly IConcreteMetadataService _deezerMetadataService; private readonly IConcreteMetadataService _qobuzMetadataService; - private readonly IEnumerable _downloadServices; + private readonly IEnumerable _downloadServices; private readonly IConfiguration _configuration; private readonly SubsonicSettings _subsonicSettings; private readonly ILogger _logger; @@ -36,7 +36,7 @@ public class PlaylistSyncService public PlaylistSyncService( IEnumerable metadataServices, - IEnumerable downloadServices, + IEnumerable downloadServices, IConfiguration configuration, IOptions subsonicSettings, ILogger logger)