diff --git a/src/TrashLib.Tests/CustomFormat/Processors/GuideProcessorTest.cs b/src/TrashLib.Tests/CustomFormat/Processors/GuideProcessorTest.cs index 27bafd35..e5e54c16 100644 --- a/src/TrashLib.Tests/CustomFormat/Processors/GuideProcessorTest.cs +++ b/src/TrashLib.Tests/CustomFormat/Processors/GuideProcessorTest.cs @@ -74,7 +74,7 @@ public class GuideProcessorTest "abc", // no score "not in guide 1" }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile1"}, new() {Name = "profile2", Score = -1234} @@ -87,7 +87,7 @@ public class GuideProcessorTest "abc", // no score "not in guide 2" }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile3"}, new() {Name = "profile4", Score = 5678} diff --git a/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs b/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs index 5e961272..8c3224b2 100644 --- a/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs +++ b/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs @@ -166,7 +166,7 @@ public class CustomFormatStepTest new() { TrashIds = new List {"id1"}, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile", Score = 200} } diff --git a/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs b/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs index f002c667..03294320 100644 --- a/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs +++ b/src/TrashLib.Tests/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs @@ -22,7 +22,7 @@ public class QualityProfileStepTest { NewCf.Processed("name1", "id1") }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile1"} } @@ -47,7 +47,7 @@ public class QualityProfileStepTest { NewCf.Processed("", "id1", 100) }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile1", Score = 50} } @@ -76,7 +76,7 @@ public class QualityProfileStepTest { NewCf.Processed("", "id1", 100) }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile1"}, new() {Name = "profile2", Score = null} @@ -111,7 +111,7 @@ public class QualityProfileStepTest { NewCf.Processed("name1", "id1", 0) }, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "profile1"} } diff --git a/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs b/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs index 93786495..7a056430 100644 --- a/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs +++ b/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs @@ -80,7 +80,7 @@ public class RadarrConfigurationTest new() { TrashIds = new List {"required value"}, - QualityProfiles = new List + QualityProfiles = new List { new() {Name = "required value"} } diff --git a/src/TrashLib/Config/Services/ServiceConfiguration.cs b/src/TrashLib/Config/Services/ServiceConfiguration.cs index 077e6b14..dfc5b1c0 100644 --- a/src/TrashLib/Config/Services/ServiceConfiguration.cs +++ b/src/TrashLib/Config/Services/ServiceConfiguration.cs @@ -6,7 +6,10 @@ public abstract class ServiceConfiguration : IServiceConfiguration { public string BaseUrl { get; init; } = ""; public string ApiKey { get; init; } = ""; - public ICollection CustomFormats { get; init; } = new List(); + + public ICollection CustomFormats { get; init; } = + new List(); + public bool DeleteOldCustomFormats { get; init; } } @@ -14,11 +17,13 @@ public abstract class ServiceConfiguration : IServiceConfiguration public class CustomFormatConfig { public ICollection TrashIds { get; init; } = new List(); - public ICollection QualityProfiles { get; init; } = new List(); + + public ICollection QualityProfiles { get; init; } = + new List(); } [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] -public class QualityProfileConfig +public class QualityProfileScoreConfig { public string Name { get; init; } = ""; public int? Score { get; init; } diff --git a/src/TrashLib/Services/CustomFormat/Models/ProcessedConfigData.cs b/src/TrashLib/Services/CustomFormat/Models/ProcessedConfigData.cs index 5c8ef965..23f48560 100644 --- a/src/TrashLib/Services/CustomFormat/Models/ProcessedConfigData.cs +++ b/src/TrashLib/Services/CustomFormat/Models/ProcessedConfigData.cs @@ -7,6 +7,6 @@ public class ProcessedConfigData public ICollection CustomFormats { get; init; } = new List(); - public ICollection QualityProfiles { get; init; } - = new List(); + public ICollection QualityProfiles { get; init; } + = new List(); } diff --git a/src/TrashLib/Services/Radarr/Config/RadarrConfigurationValidator.cs b/src/TrashLib/Services/Radarr/Config/RadarrConfigurationValidator.cs index f37b611e..3f57af86 100644 --- a/src/TrashLib/Services/Radarr/Config/RadarrConfigurationValidator.cs +++ b/src/TrashLib/Services/Radarr/Config/RadarrConfigurationValidator.cs @@ -25,17 +25,17 @@ internal class CustomFormatConfigValidator : AbstractValidator qualityProfileConfigValidator) + IValidator qualityProfileScoreConfigValidator) { RuleFor(x => x.TrashIds).NotEmpty().WithMessage(messages.CustomFormatTrashIds); - RuleForEach(x => x.QualityProfiles).SetValidator(qualityProfileConfigValidator); + RuleForEach(x => x.QualityProfiles).SetValidator(qualityProfileScoreConfigValidator); } } [UsedImplicitly] -internal class QualityProfileConfigValidator : AbstractValidator +internal class QualityProfileScoreConfigValidator : AbstractValidator { - public QualityProfileConfigValidator(IRadarrValidationMessages messages) + public QualityProfileScoreConfigValidator(IRadarrValidationMessages messages) { RuleFor(x => x.Name).NotEmpty().WithMessage(messages.QualityProfileName); }