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.
52 lines
2.1 KiB
52 lines
2.1 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Indexers.TorrentRss
|
|
{
|
|
public class TorrentRssIndexerSettingsValidator : AbstractValidator<TorrentRssIndexerSettings>
|
|
{
|
|
public TorrentRssIndexerSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
|
|
RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator());
|
|
}
|
|
}
|
|
|
|
public class TorrentRssIndexerSettings : ITorrentIndexerSettings
|
|
{
|
|
private static readonly TorrentRssIndexerSettingsValidator Validator = new TorrentRssIndexerSettingsValidator();
|
|
|
|
public TorrentRssIndexerSettings()
|
|
{
|
|
BaseUrl = string.Empty;
|
|
AllowZeroSize = false;
|
|
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
}
|
|
|
|
[FieldDefinition(0, Label = "Full RSS Feed URL")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "Cookie", HelpText = "If you site requires a login cookie to access the rss, you'll have to retrieve it via a browser.")]
|
|
public string Cookie { get; set; }
|
|
|
|
[FieldDefinition(2, Type = FieldType.Checkbox, Label = "Allow Zero Size", HelpText = "Enabling this will allow you to use feeds that don't specify release size, but be careful, size related checks will not be performed.")]
|
|
public bool AllowZeroSize { 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; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|