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.
49 lines
2.1 KiB
49 lines
2.1 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|
{
|
|
public class BroadcastheNetSettingsValidator : AbstractValidator<BroadcastheNetSettings>
|
|
{
|
|
public BroadcastheNetSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
|
|
RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator(1.0, 24 * 60, 5 * 24 * 60));
|
|
}
|
|
}
|
|
|
|
public class BroadcastheNetSettings : ITorrentIndexerSettings
|
|
{
|
|
private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator();
|
|
|
|
public BroadcastheNetSettings()
|
|
{
|
|
BaseUrl = "https://api.broadcasthe.net/";
|
|
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
}
|
|
|
|
[FieldDefinition(0, Label = "IndexerSettingsApiUrl", Advanced = true, HelpText = "IndexerSettingsApiUrlHelpText")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey)]
|
|
public string ApiKey { get; set; }
|
|
|
|
[FieldDefinition(2, Type = FieldType.Number, Label = "IndexerSettingsMinimumSeeders", HelpText = "IndexerSettingsMinimumSeedersHelpText", Advanced = true)]
|
|
public int MinimumSeeders { get; set; }
|
|
|
|
[FieldDefinition(3)]
|
|
public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings();
|
|
|
|
[FieldDefinition(4, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)]
|
|
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|