2017-01-09 13:30:15 +00:00
using FluentValidation ;
using NzbDrone.Core.Annotations ;
using NzbDrone.Core.ThingiProvider ;
using NzbDrone.Core.Validation ;
using System.Text.RegularExpressions ;
namespace NzbDrone.Core.Indexers.PassThePopcorn
{
public class PassThePopcornSettingsValidator : AbstractValidator < PassThePopcornSettings >
{
public PassThePopcornSettingsValidator ( )
{
RuleFor ( c = > c . BaseUrl ) . ValidRootUrl ( ) ;
2017-01-30 06:48:28 +00:00
RuleFor ( c = > c . Username ) . NotEmpty ( ) ;
RuleFor ( c = > c . Password ) . NotEmpty ( ) ;
RuleFor ( c = > c . Passkey ) . NotEmpty ( ) ;
2017-01-09 13:30:15 +00:00
}
}
2017-06-12 12:47:05 +00:00
public class PassThePopcornSettings : ITorrentIndexerSettings
2017-01-09 13:30:15 +00:00
{
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator ( ) ;
public PassThePopcornSettings ( )
{
BaseUrl = "https://passthepopcorn.me" ;
2017-06-12 12:47:05 +00:00
MinimumSeeders = 0 ;
2017-01-09 13:30:15 +00:00
}
2017-01-30 06:48:28 +00:00
[FieldDefinition(0, Label = "URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your cookie will be sent to that host.")]
2017-01-09 13:30:15 +00:00
public string BaseUrl { get ; set ; }
2017-01-30 06:48:28 +00:00
[FieldDefinition(1, Label = "Username", HelpText = "PTP Username")]
public string Username { get ; set ; }
2017-01-30 21:35:12 +00:00
[FieldDefinition(2, Label = "Password", Type = FieldType.Password, HelpText = "PTP Password")]
2017-01-30 06:48:28 +00:00
public string Password { get ; set ; }
2017-01-30 21:35:12 +00:00
[FieldDefinition(3, Label = "Passkey", HelpText = "PTP Passkey")]
2017-01-30 06:48:28 +00:00
public string Passkey { get ; set ; }
2017-01-09 13:30:15 +00:00
2017-01-30 06:48:28 +00:00
[FieldDefinition(4, Label = "Prefer Golden", Type = FieldType.Checkbox , HelpText = "Favors Golden Popcorn-releases over all other releases.")]
2017-01-09 13:30:15 +00:00
public bool Golden { get ; set ; }
2017-01-30 06:48:28 +00:00
[FieldDefinition(5, Label = "Prefer Scene", Type = FieldType.Checkbox, HelpText = "Favors scene-releases over non-scene releases.")]
2017-01-09 13:30:15 +00:00
public bool Scene { get ; set ; }
2017-01-30 06:48:28 +00:00
[FieldDefinition(6, Label = "Require Approved", Type = FieldType.Checkbox, HelpText = "Require staff-approval for releases to be accepted.")]
2017-02-10 06:35:47 +00:00
public bool RequireApproved { get ; set ; }
2017-01-09 13:30:15 +00:00
2017-02-10 06:35:47 +00:00
[FieldDefinition(7, Label = "Require Golden", Type = FieldType.Checkbox, HelpText = "Require Golden Popcorn-releases for releases to be accepted.")]
public bool RequireGolden { get ; set ; }
2017-01-26 19:43:24 +00:00
2017-06-12 12:47:05 +00:00
[FieldDefinition(8, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
public int MinimumSeeders { get ; set ; }
2017-01-09 13:30:15 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
}
}