2017-06-12 12:47:05 +00:00
using FluentValidation ;
2015-02-12 06:42:31 +00:00
using NzbDrone.Core.Annotations ;
using NzbDrone.Core.Validation ;
2015-05-14 20:57:45 +00:00
namespace NzbDrone.Core.Indexers.TorrentRss
2015-02-12 06:42:31 +00:00
{
public class TorrentRssIndexerSettingsValidator : AbstractValidator < TorrentRssIndexerSettings >
{
public TorrentRssIndexerSettingsValidator ( )
{
RuleFor ( c = > c . BaseUrl ) . ValidRootUrl ( ) ;
}
}
2017-06-12 12:47:05 +00:00
public class TorrentRssIndexerSettings : ITorrentIndexerSettings
2015-02-12 06:42:31 +00:00
{
private static readonly TorrentRssIndexerSettingsValidator validator = new TorrentRssIndexerSettingsValidator ( ) ;
public TorrentRssIndexerSettings ( )
{
BaseUrl = string . Empty ;
2015-05-14 20:57:45 +00:00
AllowZeroSize = false ;
2017-06-12 12:47:05 +00:00
MinimumSeeders = IndexerDefaults . MINIMUM_SEEDERS ;
2015-02-12 06:42:31 +00:00
}
[FieldDefinition(0, Label = "Full RSS Feed URL")]
2015-05-14 20:57:45 +00:00
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 ; }
2015-02-12 06:42:31 +00:00
2017-06-12 12:47:05 +00:00
[FieldDefinition(3, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
public int MinimumSeeders { get ; set ; }
2015-02-12 06:42:31 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( validator . Validate ( this ) ) ;
}
}
}