parent
154efc2c14
commit
06a00cdfef
@ -1,21 +0,0 @@
|
||||
using Autofac;
|
||||
using Autofac.Extras.Ordering;
|
||||
using Recyclarr.Cli.Migration.Steps;
|
||||
|
||||
namespace Recyclarr.Cli.Migration;
|
||||
|
||||
public class MigrationAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<MigrationExecutor>().As<IMigrationExecutor>();
|
||||
|
||||
// Migration Steps
|
||||
builder.RegisterTypes(
|
||||
typeof(MoveOsxAppDataDotnet8),
|
||||
typeof(DeleteRepoDirMigrationStep))
|
||||
.As<IMigrationStep>()
|
||||
.OrderByRegistration();
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Cache;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.Cache;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.Models;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.PipelinePhases;
|
||||
|
||||
namespace Recyclarr.Cli.Pipelines.CustomFormat;
|
||||
|
||||
public class CustomFormatAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<ProcessedCustomFormatCache>()
|
||||
.As<IPipelineCache>()
|
||||
.AsSelf()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<CustomFormatDataLister>();
|
||||
builder.RegisterType<CustomFormatCachePersister>().As<ICachePersister<CustomFormatCache>>();
|
||||
builder.RegisterType<CustomFormatTransactionLogger>();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(CustomFormatConfigPhase),
|
||||
typeof(CustomFormatApiFetchPhase),
|
||||
typeof(CustomFormatTransactionPhase),
|
||||
typeof(CustomFormatPreviewPhase),
|
||||
typeof(CustomFormatApiPersistencePhase),
|
||||
typeof(CustomFormatLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Cli.Pipelines.MediaNaming.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.MediaNaming.PipelinePhases.Config;
|
||||
using Recyclarr.TrashGuide;
|
||||
|
||||
namespace Recyclarr.Cli.Pipelines.MediaNaming;
|
||||
|
||||
public class MediaNamingAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<MediaNamingDataLister>();
|
||||
|
||||
builder.RegisterType<RadarrMediaNamingConfigPhase>()
|
||||
.Keyed<IServiceBasedMediaNamingConfigPhase>(SupportedServices.Radarr);
|
||||
builder.RegisterType<SonarrMediaNamingConfigPhase>()
|
||||
.Keyed<IServiceBasedMediaNamingConfigPhase>(SupportedServices.Sonarr);
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(MediaNamingConfigPhase),
|
||||
typeof(MediaNamingApiFetchPhase),
|
||||
typeof(MediaNamingTransactionPhase),
|
||||
typeof(MediaNamingPreviewPhase),
|
||||
typeof(MediaNamingApiPersistencePhase),
|
||||
typeof(MediaNamingLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
using Autofac;
|
||||
using Autofac.Extras.Ordering;
|
||||
using Recyclarr.Cache;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.Cache;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.Models;
|
||||
using Recyclarr.Cli.Pipelines.CustomFormat.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.Generic;
|
||||
using Recyclarr.Cli.Pipelines.MediaNaming;
|
||||
using Recyclarr.Cli.Pipelines.MediaNaming.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.MediaNaming.PipelinePhases.Config;
|
||||
using Recyclarr.Cli.Pipelines.QualityProfile;
|
||||
using Recyclarr.Cli.Pipelines.QualityProfile.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.QualitySize;
|
||||
using Recyclarr.Cli.Pipelines.QualitySize.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.QualitySize.PipelinePhases.Limits;
|
||||
using Recyclarr.Cli.Processors.Sync;
|
||||
using Recyclarr.TrashGuide;
|
||||
using Recyclarr.TrashGuide.QualitySize;
|
||||
|
||||
namespace Recyclarr.Cli.Pipelines;
|
||||
|
||||
public class PipelineAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterGeneric(typeof(GenericPipelinePhases<>));
|
||||
builder.RegisterComposite<CompositeSyncPipeline, ISyncPipeline>();
|
||||
builder.RegisterTypes(
|
||||
// ORDER HERE IS IMPORTANT!
|
||||
// There are indirect dependencies between pipelines.
|
||||
typeof(GenericSyncPipeline<CustomFormatPipelineContext>),
|
||||
typeof(GenericSyncPipeline<QualityProfilePipelineContext>),
|
||||
typeof(GenericSyncPipeline<QualitySizePipelineContext>),
|
||||
typeof(GenericSyncPipeline<MediaNamingPipelineContext>))
|
||||
.As<ISyncPipeline>()
|
||||
.OrderByRegistration();
|
||||
|
||||
RegisterQualityProfile(builder);
|
||||
RegisterQualitySize(builder);
|
||||
RegisterCustomFormat(builder);
|
||||
RegisterMediaNaming(builder);
|
||||
}
|
||||
|
||||
private static void RegisterMediaNaming(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<MediaNamingDataLister>();
|
||||
|
||||
builder.RegisterType<RadarrMediaNamingConfigPhase>()
|
||||
.Keyed<IServiceBasedMediaNamingConfigPhase>(SupportedServices.Radarr);
|
||||
builder.RegisterType<SonarrMediaNamingConfigPhase>()
|
||||
.Keyed<IServiceBasedMediaNamingConfigPhase>(SupportedServices.Sonarr);
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(MediaNamingConfigPhase),
|
||||
typeof(MediaNamingApiFetchPhase),
|
||||
typeof(MediaNamingTransactionPhase),
|
||||
typeof(MediaNamingPreviewPhase),
|
||||
typeof(MediaNamingApiPersistencePhase),
|
||||
typeof(MediaNamingLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
|
||||
private static void RegisterQualityProfile(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<QualityProfileStatCalculator>();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(QualityProfileConfigPhase),
|
||||
typeof(QualityProfilePreviewPhase),
|
||||
typeof(QualityProfileApiFetchPhase),
|
||||
typeof(QualityProfileTransactionPhase),
|
||||
typeof(QualityProfileApiPersistencePhase),
|
||||
typeof(QualityProfileLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
|
||||
private static void RegisterQualitySize(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<QualitySizeDataLister>();
|
||||
|
||||
// Setup factory for creation of concrete IQualityItemLimits types
|
||||
builder.RegisterType<QualityItemLimitFactory>().As<IQualityItemLimitFactory>();
|
||||
builder.RegisterType<RadarrQualityItemLimitFetcher>()
|
||||
.Keyed<IQualityItemLimitFetcher>(SupportedServices.Radarr)
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<SonarrQualityItemLimitFetcher>()
|
||||
.Keyed<IQualityItemLimitFetcher>(SupportedServices.Sonarr)
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(QualitySizeConfigPhase),
|
||||
typeof(QualitySizePreviewPhase),
|
||||
typeof(QualitySizeApiFetchPhase),
|
||||
typeof(QualitySizeTransactionPhase),
|
||||
typeof(QualitySizeApiPersistencePhase),
|
||||
typeof(QualitySizeLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
|
||||
private static void RegisterCustomFormat(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<ProcessedCustomFormatCache>()
|
||||
.As<IPipelineCache>()
|
||||
.AsSelf()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<CustomFormatDataLister>();
|
||||
builder.RegisterType<CustomFormatCachePersister>().As<ICachePersister<CustomFormatCache>>();
|
||||
builder.RegisterType<CustomFormatTransactionLogger>();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(CustomFormatConfigPhase),
|
||||
typeof(CustomFormatApiFetchPhase),
|
||||
typeof(CustomFormatTransactionPhase),
|
||||
typeof(CustomFormatPreviewPhase),
|
||||
typeof(CustomFormatApiPersistencePhase),
|
||||
typeof(CustomFormatLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Cli.Pipelines.QualityProfile.PipelinePhases;
|
||||
|
||||
namespace Recyclarr.Cli.Pipelines.QualityProfile;
|
||||
|
||||
public class QualityProfileAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
builder.RegisterType<QualityProfileStatCalculator>();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(QualityProfileConfigPhase),
|
||||
typeof(QualityProfilePreviewPhase),
|
||||
typeof(QualityProfileApiFetchPhase),
|
||||
typeof(QualityProfileTransactionPhase),
|
||||
typeof(QualityProfileApiPersistencePhase),
|
||||
typeof(QualityProfileLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Cli.Pipelines.QualitySize.PipelinePhases;
|
||||
using Recyclarr.Cli.Pipelines.QualitySize.PipelinePhases.Limits;
|
||||
using Recyclarr.TrashGuide;
|
||||
using Recyclarr.TrashGuide.QualitySize;
|
||||
|
||||
namespace Recyclarr.Cli.Pipelines.QualitySize;
|
||||
|
||||
public class QualitySizeAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<QualitySizeDataLister>();
|
||||
|
||||
// Setup factory for creation of concrete IQualityItemLimits types
|
||||
builder.RegisterType<QualityItemLimitFactory>().As<IQualityItemLimitFactory>();
|
||||
builder.RegisterType<RadarrQualityItemLimitFetcher>()
|
||||
.Keyed<IQualityItemLimitFetcher>(SupportedServices.Radarr)
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<SonarrQualityItemLimitFetcher>()
|
||||
.Keyed<IQualityItemLimitFetcher>(SupportedServices.Sonarr)
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(QualitySizeConfigPhase),
|
||||
typeof(QualitySizePreviewPhase),
|
||||
typeof(QualitySizeApiFetchPhase),
|
||||
typeof(QualitySizeTransactionPhase),
|
||||
typeof(QualitySizeApiPersistencePhase),
|
||||
typeof(QualitySizeLogPhase))
|
||||
.AsImplementedInterfaces();
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
using Autofac;
|
||||
using Autofac.Extras.Ordering;
|
||||
using Recyclarr.Cli.Processors.Config;
|
||||
using Recyclarr.Cli.Processors.Delete;
|
||||
using Recyclarr.Cli.Processors.ErrorHandling;
|
||||
using Recyclarr.Cli.Processors.Sync;
|
||||
|
||||
namespace Recyclarr.Cli.Processors;
|
||||
|
||||
public class ServiceProcessorsAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
builder.RegisterType<ConsoleExceptionHandler>();
|
||||
builder.RegisterType<FlurlHttpExceptionHandler>();
|
||||
|
||||
// Sync
|
||||
builder.RegisterType<SyncProcessor>().As<ISyncProcessor>();
|
||||
|
||||
// Configuration
|
||||
builder.RegisterType<ConfigManipulator>().As<IConfigManipulator>();
|
||||
builder.RegisterType<ConfigCreationProcessor>().As<IConfigCreationProcessor>();
|
||||
builder.RegisterType<ConfigListLocalProcessor>();
|
||||
builder.RegisterType<ConfigListTemplateProcessor>();
|
||||
|
||||
// Delete
|
||||
builder.RegisterType<DeleteCustomFormatsProcessor>().As<IDeleteCustomFormatsProcessor>();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(TemplateConfigCreator),
|
||||
typeof(LocalConfigCreator))
|
||||
.As<IConfigCreator>()
|
||||
.OrderByRegistration();
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using Autofac;
|
||||
|
||||
namespace Recyclarr.Cache;
|
||||
|
||||
public class CacheAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<CacheStoragePath>().As<ICacheStoragePath>();
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Common.FluentValidation;
|
||||
|
||||
namespace Recyclarr.Common;
|
||||
|
||||
public class CommonAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<RuntimeValidationService>().As<IRuntimeValidationService>();
|
||||
builder.RegisterType<ValidationLogger>();
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Compatibility.Radarr;
|
||||
using Recyclarr.Compatibility.Sonarr;
|
||||
|
||||
namespace Recyclarr.Compatibility;
|
||||
|
||||
public class CompatibilityAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
builder.RegisterType<ServiceAgnosticCapabilityEnforcer>();
|
||||
builder.RegisterType<ServiceInformation>().As<IServiceInformation>()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
// Sonarr
|
||||
builder.RegisterType<SonarrCapabilityFetcher>().As<ISonarrCapabilityFetcher>();
|
||||
builder.RegisterType<SonarrCapabilityEnforcer>();
|
||||
|
||||
// Radarr
|
||||
builder.RegisterType<RadarrCapabilityFetcher>().As<IRadarrCapabilityFetcher>();
|
||||
builder.RegisterType<RadarrCapabilityEnforcer>();
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
using Autofac;
|
||||
using Autofac.Extras.Ordering;
|
||||
using AutoMapper.Contrib.Autofac.DependencyInjection;
|
||||
using FluentValidation;
|
||||
using Recyclarr.Config.Parsing;
|
||||
using Recyclarr.Config.Parsing.PostProcessing;
|
||||
using Recyclarr.Config.Parsing.PostProcessing.ConfigMerging;
|
||||
using Recyclarr.Config.Parsing.PostProcessing.Deprecations;
|
||||
using Recyclarr.Config.Secrets;
|
||||
using Recyclarr.Yaml;
|
||||
|
||||
namespace Recyclarr.Config;
|
||||
|
||||
public class ConfigAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterAutoMapper(ThisAssembly);
|
||||
|
||||
builder.RegisterAssemblyTypes(ThisAssembly)
|
||||
.AssignableTo<IYamlBehavior>()
|
||||
.As<IYamlBehavior>();
|
||||
|
||||
builder.RegisterType<SecretsProvider>().As<ISecretsProvider>().SingleInstance();
|
||||
builder.RegisterType<YamlIncludeResolver>().As<IYamlIncludeResolver>();
|
||||
builder.RegisterType<ConfigurationRegistry>().As<IConfigurationRegistry>();
|
||||
builder.RegisterType<ConfigurationLoader>().As<IConfigurationLoader>();
|
||||
builder.RegisterType<ConfigurationFinder>().As<IConfigurationFinder>();
|
||||
builder.RegisterType<ConfigValidationExecutor>();
|
||||
builder.RegisterType<ConfigParser>();
|
||||
builder.RegisterType<ConfigSaver>();
|
||||
builder.RegisterType<ConfigurationScopeFactory>();
|
||||
|
||||
// Keyed include processors
|
||||
builder.RegisterType<ConfigIncludeProcessor>().Keyed<IIncludeProcessor>(typeof(ConfigYamlInclude));
|
||||
builder.RegisterType<TemplateIncludeProcessor>().Keyed<IIncludeProcessor>(typeof(TemplateYamlInclude));
|
||||
|
||||
// Config Post Processors
|
||||
builder.RegisterTypes(
|
||||
// Order-sensitive!
|
||||
typeof(ConfigDeprecationPostProcessor),
|
||||
typeof(ImplicitUrlAndKeyPostProcessor),
|
||||
typeof(IncludePostProcessor))
|
||||
.As<IConfigPostProcessor>()
|
||||
.OrderByRegistration();
|
||||
|
||||
// Config Deprecations
|
||||
builder.RegisterType<ConfigDeprecations>();
|
||||
builder.RegisterTypes(
|
||||
// Order-sensitive!
|
||||
typeof(CfQualityProfilesDeprecationCheck))
|
||||
.As<IConfigDeprecationCheck>()
|
||||
.OrderByRegistration();
|
||||
|
||||
RegisterValidators(builder);
|
||||
}
|
||||
|
||||
private static void RegisterValidators(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<RootConfigYamlValidator>().As<IValidator>();
|
||||
|
||||
// These validators are required by IncludePostProcessor
|
||||
builder.RegisterType<RadarrConfigYamlValidator>().As<IValidator>();
|
||||
builder.RegisterType<SonarrConfigYamlValidator>().As<IValidator>();
|
||||
}
|
||||
}
|
@ -0,0 +1,258 @@
|
||||
using System.Text.Json;
|
||||
using Autofac;
|
||||
using Autofac.Extras.Ordering;
|
||||
using AutoMapper.Contrib.Autofac.DependencyInjection;
|
||||
using FluentValidation;
|
||||
using Flurl.Http.Configuration;
|
||||
using Recyclarr.Cache;
|
||||
using Recyclarr.Common.FluentValidation;
|
||||
using Recyclarr.Compatibility;
|
||||
using Recyclarr.Compatibility.Radarr;
|
||||
using Recyclarr.Compatibility.Sonarr;
|
||||
using Recyclarr.Config;
|
||||
using Recyclarr.Config.Parsing;
|
||||
using Recyclarr.Config.Parsing.PostProcessing;
|
||||
using Recyclarr.Config.Parsing.PostProcessing.ConfigMerging;
|
||||
using Recyclarr.Config.Parsing.PostProcessing.Deprecations;
|
||||
using Recyclarr.Config.Secrets;
|
||||
using Recyclarr.Http;
|
||||
using Recyclarr.Json.Loading;
|
||||
using Recyclarr.Logging;
|
||||
using Recyclarr.Notifications;
|
||||
using Recyclarr.Notifications.Apprise;
|
||||
using Recyclarr.Platform;
|
||||
using Recyclarr.Repo;
|
||||
using Recyclarr.ServarrApi;
|
||||
using Recyclarr.ServarrApi.CustomFormat;
|
||||
using Recyclarr.ServarrApi.MediaNaming;
|
||||
using Recyclarr.ServarrApi.QualityDefinition;
|
||||
using Recyclarr.ServarrApi.QualityProfile;
|
||||
using Recyclarr.ServarrApi.System;
|
||||
using Recyclarr.Settings;
|
||||
using Recyclarr.TrashGuide;
|
||||
using Recyclarr.TrashGuide.CustomFormat;
|
||||
using Recyclarr.TrashGuide.MediaNaming;
|
||||
using Recyclarr.TrashGuide.QualitySize;
|
||||
using Recyclarr.VersionControl;
|
||||
using Recyclarr.Yaml;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.ObjectFactories;
|
||||
|
||||
namespace Recyclarr;
|
||||
|
||||
public class CoreAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
RegisterCache(builder);
|
||||
RegisterCommon(builder);
|
||||
RegisterCompatibility(builder);
|
||||
RegisterConfig(builder);
|
||||
RegisterHttp(builder);
|
||||
RegisterJson(builder);
|
||||
RegisterNotifications(builder);
|
||||
RegisterPlatform(builder);
|
||||
RegisterRepo(builder);
|
||||
RegisterServarrApi(builder);
|
||||
RegisterSettings(builder);
|
||||
RegisterTrashGuide(builder);
|
||||
RegisterYaml(builder);
|
||||
RegisterVersionControl(builder);
|
||||
}
|
||||
|
||||
private static void RegisterCache(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<CacheStoragePath>().As<ICacheStoragePath>();
|
||||
}
|
||||
|
||||
private static void RegisterCommon(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<RuntimeValidationService>().As<IRuntimeValidationService>();
|
||||
builder.RegisterType<ValidationLogger>();
|
||||
}
|
||||
|
||||
private static void RegisterCompatibility(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<ServiceAgnosticCapabilityEnforcer>();
|
||||
builder.RegisterType<ServiceInformation>().As<IServiceInformation>()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
// Sonarr
|
||||
builder.RegisterType<SonarrCapabilityFetcher>().As<ISonarrCapabilityFetcher>();
|
||||
builder.RegisterType<SonarrCapabilityEnforcer>();
|
||||
|
||||
// Radarr
|
||||
builder.RegisterType<RadarrCapabilityFetcher>().As<IRadarrCapabilityFetcher>();
|
||||
builder.RegisterType<RadarrCapabilityEnforcer>();
|
||||
}
|
||||
|
||||
private void RegisterConfig(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterAutoMapper(ThisAssembly);
|
||||
|
||||
builder.RegisterAssemblyTypes(ThisAssembly)
|
||||
.AssignableTo<IYamlBehavior>()
|
||||
.As<IYamlBehavior>();
|
||||
|
||||
builder.RegisterType<SecretsProvider>().As<ISecretsProvider>().SingleInstance();
|
||||
builder.RegisterType<YamlIncludeResolver>().As<IYamlIncludeResolver>();
|
||||
builder.RegisterType<ConfigurationRegistry>().As<IConfigurationRegistry>();
|
||||
builder.RegisterType<ConfigurationLoader>().As<IConfigurationLoader>();
|
||||
builder.RegisterType<ConfigurationFinder>().As<IConfigurationFinder>();
|
||||
builder.RegisterType<ConfigValidationExecutor>();
|
||||
builder.RegisterType<ConfigParser>();
|
||||
builder.RegisterType<ConfigSaver>();
|
||||
builder.RegisterType<ConfigurationScopeFactory>();
|
||||
|
||||
// Keyed include processors
|
||||
builder.RegisterType<ConfigIncludeProcessor>().Keyed<IIncludeProcessor>(typeof(ConfigYamlInclude));
|
||||
builder.RegisterType<TemplateIncludeProcessor>().Keyed<IIncludeProcessor>(typeof(TemplateYamlInclude));
|
||||
|
||||
// Config Post Processors
|
||||
builder.RegisterTypes(
|
||||
// Order-sensitive!
|
||||
typeof(ConfigDeprecationPostProcessor),
|
||||
typeof(ImplicitUrlAndKeyPostProcessor),
|
||||
typeof(IncludePostProcessor))
|
||||
.As<IConfigPostProcessor>()
|
||||
.OrderByRegistration();
|
||||
|
||||
// Config Deprecations
|
||||
builder.RegisterType<ConfigDeprecations>();
|
||||
builder.RegisterTypes(
|
||||
// Order-sensitive!
|
||||
typeof(CfQualityProfilesDeprecationCheck))
|
||||
.As<IConfigDeprecationCheck>()
|
||||
.OrderByRegistration();
|
||||
|
||||
builder.RegisterType<RootConfigYamlValidator>().As<IValidator>();
|
||||
|
||||
// These validators are required by IncludePostProcessor
|
||||
builder.RegisterType<RadarrConfigYamlValidator>().As<IValidator>();
|
||||
builder.RegisterType<SonarrConfigYamlValidator>().As<IValidator>();
|
||||
}
|
||||
|
||||
private static void RegisterHttp(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<FlurlClientCache>()
|
||||
.As<IFlurlClientCache>()
|
||||
.SingleInstance();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(FlurlAfterCallLogRedactor),
|
||||
typeof(FlurlBeforeCallLogRedactor),
|
||||
typeof(FlurlRedirectPreventer))
|
||||
.As<FlurlSpecificEventHandler>();
|
||||
}
|
||||
|
||||
private static void RegisterJson(ContainerBuilder builder)
|
||||
{
|
||||
builder.Register<Func<JsonSerializerOptions, IBulkJsonLoader>>(c =>
|
||||
{
|
||||
return settings => new BulkJsonLoader(c.Resolve<ILogger>(), settings);
|
||||
});
|
||||
|
||||
// Decorators for BulkJsonLoader. We do not use RegisterDecorator() here for these reasons:
|
||||
// - We consume the BulkJsonLoader as a delegate factory, not by instance
|
||||
// - We do not want all implementations of BulkJsonLoader to be decorated, only a specific implementation.
|
||||
builder.RegisterType<GuideJsonLoader>();
|
||||
builder.RegisterType<ServiceJsonLoader>();
|
||||
}
|
||||
|
||||
private static void RegisterNotifications(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<NotificationLogSinkConfigurator>().As<ILogConfigurator>();
|
||||
builder.RegisterType<NotificationService>().SingleInstance();
|
||||
builder.RegisterType<NotificationEmitter>().SingleInstance();
|
||||
|
||||
// Apprise
|
||||
builder.RegisterType<AppriseStatefulNotificationApiService>()
|
||||
.Keyed<IAppriseNotificationApiService>(AppriseMode.Stateful);
|
||||
|
||||
builder.RegisterType<AppriseStatelessNotificationApiService>()
|
||||
.Keyed<IAppriseNotificationApiService>(AppriseMode.Stateless);
|
||||
|
||||
builder.RegisterType<AppriseRequestBuilder>().As<IAppriseRequestBuilder>();
|
||||
}
|
||||
|
||||
private static void RegisterPlatform(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<DefaultAppDataSetup>().As<IAppDataSetup>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<DefaultEnvironment>().As<IEnvironment>();
|
||||
builder.RegisterType<DefaultRuntimeInformation>().As<IRuntimeInformation>();
|
||||
|
||||
builder.Register(c => c.Resolve<DefaultAppDataSetup>().CreateAppPaths())
|
||||
.As<IAppPaths>()
|
||||
.SingleInstance();
|
||||
}
|
||||
|
||||
private static void RegisterRepo(ContainerBuilder builder)
|
||||
{
|
||||
// Unique Repo Registrations
|
||||
builder.RegisterType<ConfigTemplatesRepo>().As<IConfigTemplatesRepo>().As<IUpdateableRepo>();
|
||||
builder.RegisterType<TrashGuidesRepo>().As<ITrashGuidesRepo>().As<IUpdateableRepo>();
|
||||
|
||||
builder.RegisterType<RepoUpdater>().As<IRepoUpdater>();
|
||||
builder.RegisterType<ConsoleMultiRepoUpdater>().As<IMultiRepoUpdater>();
|
||||
builder.RegisterType<TrashRepoMetadataBuilder>().As<IRepoMetadataBuilder>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<GitPath>().As<IGitPath>();
|
||||
}
|
||||
|
||||
private static void RegisterServarrApi(ContainerBuilder builder)
|
||||
{
|
||||
// This is used by all specific API service classes registered below.
|
||||
builder.RegisterType<ServarrRequestBuilder>().As<IServarrRequestBuilder>();
|
||||
|
||||
builder.RegisterType<SystemApiService>().As<ISystemApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<QualityProfileApiService>().As<IQualityProfileApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<CustomFormatApiService>().As<ICustomFormatApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<QualityDefinitionApiService>().As<IQualityDefinitionApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<MediaNamingApiService>().As<IMediaNamingApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
}
|
||||
|
||||
private static void RegisterSettings(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<SettingsLoader>();
|
||||
builder.RegisterType<SettingsProvider>().SingleInstance();
|
||||
|
||||
builder.RegisterSettings(x => x);
|
||||
builder.RegisterSettings(x => x.LogJanitor);
|
||||
builder.RegisterSettings(x => x.Repositories.ConfigTemplates);
|
||||
builder.RegisterSettings(x => x.Repositories.TrashGuides);
|
||||
builder.RegisterSettings(x => x.Notifications);
|
||||
}
|
||||
|
||||
private static void RegisterTrashGuide(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<ConfigTemplateGuideService>().As<IConfigTemplateGuideService>().SingleInstance();
|
||||
|
||||
// Custom Format
|
||||
builder.RegisterType<CustomFormatGuideService>().As<ICustomFormatGuideService>().SingleInstance();
|
||||
builder.RegisterType<CustomFormatLoader>().As<ICustomFormatLoader>();
|
||||
builder.RegisterType<CustomFormatCategoryParser>().As<ICustomFormatCategoryParser>();
|
||||
|
||||
// Quality Size
|
||||
builder.RegisterType<QualitySizeGuideService>().As<IQualitySizeGuideService>().SingleInstance();
|
||||
builder.RegisterType<QualitySizeGuideParser>();
|
||||
|
||||
// Media Naming
|
||||
builder.RegisterType<MediaNamingGuideService>().As<IMediaNamingGuideService>();
|
||||
}
|
||||
|
||||
private static void RegisterYaml(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<YamlSerializerFactory>().As<IYamlSerializerFactory>();
|
||||
builder.RegisterType<DefaultObjectFactory>().As<IObjectFactory>();
|
||||
}
|
||||
|
||||
private static void RegisterVersionControl(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<GitRepositoryFactory>().As<IGitRepositoryFactory>();
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using Autofac;
|
||||
using Flurl.Http.Configuration;
|
||||
|
||||
namespace Recyclarr.Http;
|
||||
|
||||
public class HttpAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<FlurlClientCache>()
|
||||
.As<IFlurlClientCache>()
|
||||
.SingleInstance();
|
||||
|
||||
builder.RegisterTypes(
|
||||
typeof(FlurlAfterCallLogRedactor),
|
||||
typeof(FlurlBeforeCallLogRedactor),
|
||||
typeof(FlurlRedirectPreventer))
|
||||
.As<FlurlSpecificEventHandler>();
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using Autofac;
|
||||
using Recyclarr.Json.Loading;
|
||||
|
||||
namespace Recyclarr.Json;
|
||||
|
||||
public class JsonAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.Register<Func<JsonSerializerOptions, IBulkJsonLoader>>(c =>
|
||||
{
|
||||
return settings => new BulkJsonLoader(c.Resolve<ILogger>(), settings);
|
||||
});
|
||||
|
||||
// Decorators for BulkJsonLoader. We do not use RegisterDecorator() here for these reasons:
|
||||
// - We consume the BulkJsonLoader as a delegate factory, not by instance
|
||||
// - We do not want all implementations of BulkJsonLoader to be decorated, only a specific implementation.
|
||||
builder.RegisterType<GuideJsonLoader>();
|
||||
builder.RegisterType<ServiceJsonLoader>();
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.Logging;
|
||||
using Recyclarr.Notifications.Apprise;
|
||||
using Recyclarr.Settings;
|
||||
|
||||
namespace Recyclarr.Notifications;
|
||||
|
||||
public class NotificationsAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
builder.RegisterType<NotificationLogSinkConfigurator>().As<ILogConfigurator>();
|
||||
builder.RegisterType<NotificationService>().SingleInstance();
|
||||
builder.RegisterType<NotificationEmitter>().SingleInstance();
|
||||
|
||||
// Apprise
|
||||
builder.RegisterType<AppriseStatefulNotificationApiService>()
|
||||
.Keyed<IAppriseNotificationApiService>(AppriseMode.Stateful);
|
||||
|
||||
builder.RegisterType<AppriseStatelessNotificationApiService>()
|
||||
.Keyed<IAppriseNotificationApiService>(AppriseMode.Stateless);
|
||||
|
||||
builder.RegisterType<AppriseRequestBuilder>().As<IAppriseRequestBuilder>();
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using Autofac;
|
||||
|
||||
namespace Recyclarr.Platform;
|
||||
|
||||
public class PlatformAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
RegisterAppPaths(builder);
|
||||
}
|
||||
|
||||
private static void RegisterAppPaths(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<DefaultAppDataSetup>().As<IAppDataSetup>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<DefaultEnvironment>().As<IEnvironment>();
|
||||
builder.RegisterType<DefaultRuntimeInformation>().As<IRuntimeInformation>();
|
||||
|
||||
builder.Register(c => c.Resolve<DefaultAppDataSetup>().CreateAppPaths())
|
||||
.As<IAppPaths>()
|
||||
.SingleInstance();
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.VersionControl;
|
||||
|
||||
namespace Recyclarr.Repo;
|
||||
|
||||
public class RepoAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
// Unique Repo Registrations
|
||||
builder.RegisterType<ConfigTemplatesRepo>().As<IConfigTemplatesRepo>().As<IUpdateableRepo>();
|
||||
builder.RegisterType<TrashGuidesRepo>().As<ITrashGuidesRepo>().As<IUpdateableRepo>();
|
||||
|
||||
builder.RegisterType<RepoUpdater>().As<IRepoUpdater>();
|
||||
builder.RegisterType<ConsoleMultiRepoUpdater>().As<IMultiRepoUpdater>();
|
||||
builder.RegisterType<TrashRepoMetadataBuilder>().As<IRepoMetadataBuilder>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<GitPath>().As<IGitPath>();
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.ServarrApi.CustomFormat;
|
||||
using Recyclarr.ServarrApi.MediaNaming;
|
||||
using Recyclarr.ServarrApi.QualityDefinition;
|
||||
using Recyclarr.ServarrApi.QualityProfile;
|
||||
using Recyclarr.ServarrApi.System;
|
||||
|
||||
namespace Recyclarr.ServarrApi;
|
||||
|
||||
public class ServarrApiAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
// This is used by all specific API service classes registered below.
|
||||
builder.RegisterType<ServarrRequestBuilder>().As<IServarrRequestBuilder>();
|
||||
|
||||
builder.RegisterType<SystemApiService>().As<ISystemApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<QualityProfileApiService>().As<IQualityProfileApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<CustomFormatApiService>().As<ICustomFormatApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<QualityDefinitionApiService>().As<IQualityDefinitionApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
builder.RegisterType<MediaNamingApiService>().As<IMediaNamingApiService>()
|
||||
.InstancePerLifetimeScope();
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Autofac;
|
||||
|
||||
namespace Recyclarr.Settings;
|
||||
|
||||
public class SettingsAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
builder.RegisterType<SettingsLoader>();
|
||||
builder.RegisterType<SettingsProvider>().SingleInstance();
|
||||
|
||||
builder.RegisterSettings(x => x);
|
||||
builder.RegisterSettings(x => x.LogJanitor);
|
||||
builder.RegisterSettings(x => x.Repositories.ConfigTemplates);
|
||||
builder.RegisterSettings(x => x.Repositories.TrashGuides);
|
||||
builder.RegisterSettings(x => x.Notifications);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using Autofac;
|
||||
using Recyclarr.TrashGuide.CustomFormat;
|
||||
using Recyclarr.TrashGuide.MediaNaming;
|
||||
using Recyclarr.TrashGuide.QualitySize;
|
||||
|
||||
namespace Recyclarr.TrashGuide;
|
||||
|
||||
public class GuideAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
base.Load(builder);
|
||||
|
||||
builder.RegisterType<ConfigTemplateGuideService>().As<IConfigTemplateGuideService>().SingleInstance();
|
||||
|
||||
// Custom Format
|
||||
builder.RegisterType<CustomFormatGuideService>().As<ICustomFormatGuideService>().SingleInstance();
|
||||
builder.RegisterType<CustomFormatLoader>().As<ICustomFormatLoader>();
|
||||
builder.RegisterType<CustomFormatCategoryParser>().As<ICustomFormatCategoryParser>();
|
||||
|
||||
// Quality Size
|
||||
builder.RegisterType<QualitySizeGuideService>().As<IQualitySizeGuideService>().SingleInstance();
|
||||
builder.RegisterType<QualitySizeGuideParser>();
|
||||
|
||||
// Media Naming
|
||||
builder.RegisterType<MediaNamingGuideService>().As<IMediaNamingGuideService>();
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using Autofac;
|
||||
|
||||
namespace Recyclarr.VersionControl;
|
||||
|
||||
public class VersionControlAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<GitRepositoryFactory>().As<IGitRepositoryFactory>();
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using Autofac;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.ObjectFactories;
|
||||
|
||||
namespace Recyclarr.Yaml;
|
||||
|
||||
public class YamlAutofacModule : Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<YamlSerializerFactory>().As<IYamlSerializerFactory>();
|
||||
builder.RegisterType<DefaultObjectFactory>().As<IObjectFactory>();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue