Merge 48c5d879c3
into e8afde2e90
commit
83b6cad2a8
@ -0,0 +1,36 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.CustomFormats
|
||||
{
|
||||
public class DownloadProtocolSpecificationValidator : AbstractValidator<DownloadProtocolSpecification>
|
||||
{
|
||||
public DownloadProtocolSpecificationValidator()
|
||||
{
|
||||
RuleFor(c => c.Value).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class DownloadProtocolSpecification : CustomFormatSpecificationBase
|
||||
{
|
||||
private static readonly DownloadProtocolSpecificationValidator Validator = new DownloadProtocolSpecificationValidator();
|
||||
|
||||
public override int Order => 11;
|
||||
public override string ImplementationName => "Download Protocol";
|
||||
|
||||
[FieldDefinition(1, Label = "CustomFormatsSpecificationDownloadProtocol", Type = FieldType.Select, SelectOptions = typeof(DownloadProtocol))]
|
||||
public int Value { get; set; }
|
||||
|
||||
protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input)
|
||||
{
|
||||
return input.DownloadProtocol == (DownloadProtocol)Value;
|
||||
}
|
||||
|
||||
public override NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(242)]
|
||||
public class add_download_protocol_to_moviefiles : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("MovieFiles").AddColumn("DownloadProtocol").AsInt32().WithDefaultValue(0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue