You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Tv;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.AutoTagging.Specifications
|
|
{
|
|
public class SeriesTypeSpecificationValidator : AbstractValidator<SeriesTypeSpecification>
|
|
{
|
|
public SeriesTypeSpecificationValidator()
|
|
{
|
|
RuleFor(c => (SeriesTypes)c.Value).IsInEnum();
|
|
}
|
|
}
|
|
|
|
public class SeriesTypeSpecification : AutoTaggingSpecificationBase
|
|
{
|
|
private static readonly SeriesTypeSpecificationValidator Validator = new SeriesTypeSpecificationValidator();
|
|
|
|
public override int Order => 2;
|
|
public override string ImplementationName => "Series Type";
|
|
|
|
[FieldDefinition(1, Label = "AutoTaggingSpecificationSeriesType", Type = FieldType.Select, SelectOptions = typeof(SeriesTypes))]
|
|
public int Value { get; set; }
|
|
|
|
protected override bool IsSatisfiedByWithoutNegate(Series series)
|
|
{
|
|
return (int)series.SeriesType == Value;
|
|
}
|
|
|
|
public override NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|