diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js index 5ec5c9978..9c2d124d7 100644 --- a/frontend/src/Components/Form/ProviderFieldFormGroup.js +++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js @@ -41,6 +41,8 @@ function getType({ type, selectOptionsProviderAction }) { return inputTypes.ROOT_FOLDER_SELECT; case 'qualityProfile': return inputTypes.QUALITY_PROFILE_SELECT; + case 'metadataProfile': + return inputTypes.METADATA_PROFILE_SELECT; default: return inputTypes.TEXT; } diff --git a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs index f81fc359f..8d098d7f6 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -68,7 +68,8 @@ namespace NzbDrone.Core.Annotations Playlist, TagSelect, RootFolder, - QualityProfile + QualityProfile, + MetadataProfile } public enum HiddenType diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/MetadataProfileSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/MetadataProfileSpecification.cs new file mode 100644 index 000000000..7df275d95 --- /dev/null +++ b/src/NzbDrone.Core/AutoTagging/Specifications/MetadataProfileSpecification.cs @@ -0,0 +1,36 @@ +using FluentValidation; +using NzbDrone.Core.Annotations; +using NzbDrone.Core.Music; +using NzbDrone.Core.Validation; + +namespace NzbDrone.Core.AutoTagging.Specifications +{ + public class MetadataProfileSpecificationValidator : AbstractValidator + { + public MetadataProfileSpecificationValidator() + { + RuleFor(c => c.Value).GreaterThan(0); + } + } + + public class MetadataProfileSpecification : AutoTaggingSpecificationBase + { + private static readonly MetadataProfileSpecificationValidator Validator = new (); + + public override int Order => 1; + public override string ImplementationName => "Metadata Profile"; + + [FieldDefinition(1, Label = "Metadata Profile", Type = FieldType.MetadataProfile)] + public int Value { get; set; } + + protected override bool IsSatisfiedByWithoutNegate(Artist artist) + { + return Value == artist.MetadataProfileId; + } + + public override NzbDroneValidationResult Validate() + { + return new NzbDroneValidationResult(Validator.Validate(this)); + } + } +}