diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js index d7486245a..a184aa1ec 100644 --- a/frontend/src/Components/Form/ProviderFieldFormGroup.js +++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js @@ -37,6 +37,8 @@ function getType({ type, selectOptionsProviderAction }) { return inputTypes.OAUTH; case 'rootFolder': return inputTypes.ROOT_FOLDER_SELECT; + case 'qualityProfile': + return inputTypes.QUALITY_PROFILE_SELECT; default: return inputTypes.TEXT; } diff --git a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs index 0a30a9f3f..7b711a37d 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -67,7 +67,8 @@ namespace NzbDrone.Core.Annotations OAuth, Device, TagSelect, - RootFolder + RootFolder, + QualityProfile } public enum HiddenType diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs new file mode 100644 index 000000000..4ac2ef14b --- /dev/null +++ b/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs @@ -0,0 +1,36 @@ +using FluentValidation; +using NzbDrone.Core.Annotations; +using NzbDrone.Core.Tv; +using NzbDrone.Core.Validation; + +namespace NzbDrone.Core.AutoTagging.Specifications +{ + public class QualityProfileSpecificationValidator : AbstractValidator + { + public QualityProfileSpecificationValidator() + { + RuleFor(c => c.Value).GreaterThan(0); + } + } + + public class QualityProfileSpecification : AutoTaggingSpecificationBase + { + private static readonly QualityProfileSpecificationValidator Validator = new (); + + public override int Order => 1; + public override string ImplementationName => "Quality Profile"; + + [FieldDefinition(1, Label = "Quality Profile", Type = FieldType.QualityProfile)] + public int Value { get; set; } + + protected override bool IsSatisfiedByWithoutNegate(Series series) + { + return Value == series.QualityProfileId; + } + + public override NzbDroneValidationResult Validate() + { + return new NzbDroneValidationResult(Validator.Validate(this)); + } + } +}