2018-02-01 13:18:52 +00:00
using System.Collections.Generic ;
using FluentValidation ;
2015-02-12 06:42:31 +00:00
using NzbDrone.Core.Annotations ;
2018-02-01 13:18:52 +00:00
using NzbDrone.Core.Parser.Model ;
2015-02-12 06:42:31 +00:00
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 ; }
2018-05-27 09:05:23 +00:00
[FieldDefinition(4, Type = FieldType.Tag, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Radarr/Radarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
2018-02-01 13:18:52 +00:00
public IEnumerable < int > RequiredFlags { get ; set ; }
2017-06-12 12:47:05 +00:00
2015-02-12 06:42:31 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( validator . Validate ( this ) ) ;
}
}
2018-05-27 09:05:23 +00:00
}