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.
48 lines
1.6 KiB
48 lines
1.6 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Validation;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace NzbDrone.Core.Indexers.Gazelle
|
|
{
|
|
public class GazelleSettingsValidator : AbstractValidator<GazelleSettings>
|
|
{
|
|
public GazelleSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
RuleFor(c => c.Username).NotEmpty();
|
|
RuleFor(c => c.Password).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class GazelleSettings : ITorrentIndexerSettings
|
|
{
|
|
private static readonly GazelleSettingsValidator Validator = new GazelleSettingsValidator();
|
|
|
|
public GazelleSettings()
|
|
{
|
|
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
}
|
|
|
|
public string AuthKey;
|
|
public string PassKey;
|
|
|
|
[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.")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "Username", HelpText = "Username")]
|
|
public string Username { get; set; }
|
|
|
|
[FieldDefinition(2, Label = "Password", Type = FieldType.Password, HelpText = "Password")]
|
|
public string Password { get; set; }
|
|
|
|
[FieldDefinition(3, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
public int MinimumSeeders { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|