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.
56 lines
2.3 KiB
56 lines
2.3 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
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", Privacy = PrivacyLevel.UserName)]
|
|
public string Username { get; set; }
|
|
|
|
[FieldDefinition(2, Label = "Password", Type = FieldType.Password, HelpText = "Password", Privacy = PrivacyLevel.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; }
|
|
|
|
[FieldDefinition(4)]
|
|
public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings();
|
|
|
|
[FieldDefinition(5, Type = FieldType.Number, Label = "Early Download Limit", Unit = "days", HelpText = "Time before release date Lidarr will download from this indexer, empty is no limit", Advanced = true)]
|
|
public int? EarlyReleaseLimit { get; set; }
|
|
|
|
[FieldDefinition(6, Type = FieldType.Checkbox, Label = "Use Freeleech Token", HelpText = "Will cause grabbing to fail if you do not have any tokens available", Advanced = true)]
|
|
public bool UseFreeleechToken { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|