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.Parser;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.CustomFormats
|
|
{
|
|
public class ResolutionSpecificationValidator : AbstractValidator<ResolutionSpecification>
|
|
{
|
|
public ResolutionSpecificationValidator()
|
|
{
|
|
RuleFor(c => c.Value).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class ResolutionSpecification : CustomFormatSpecificationBase
|
|
{
|
|
private static readonly ResolutionSpecificationValidator Validator = new ResolutionSpecificationValidator();
|
|
|
|
public override int Order => 6;
|
|
public override string ImplementationName => "Resolution";
|
|
|
|
[FieldDefinition(1, Label = "Resolution", Type = FieldType.Select, SelectOptions = typeof(Resolution))]
|
|
public int Value { get; set; }
|
|
|
|
protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input)
|
|
{
|
|
return (input.MovieInfo?.Quality?.Quality?.Resolution ?? (int)Resolution.Unknown) == Value;
|
|
}
|
|
|
|
public override NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|