2019-12-22 22:08:53 +00:00
using System.Collections.Generic ;
2017-05-29 15:56:16 +00:00
using FluentValidation ;
2015-05-24 22:47:48 +00:00
using NzbDrone.Core.Annotations ;
2015-04-14 04:30:02 +00:00
using NzbDrone.Core.Validation ;
namespace NzbDrone.Core.Indexers.HDBits
{
2015-05-24 22:47:48 +00:00
public class HDBitsSettingsValidator : AbstractValidator < HDBitsSettings >
2015-04-14 04:30:02 +00:00
{
2015-05-24 22:47:48 +00:00
public HDBitsSettingsValidator ( )
2015-04-14 04:30:02 +00:00
{
RuleFor ( c = > c . BaseUrl ) . ValidRootUrl ( ) ;
RuleFor ( c = > c . ApiKey ) . NotEmpty ( ) ;
2019-06-14 03:54:25 +00:00
RuleFor ( c = > c . SeedCriteria ) . SetValidator ( _ = > new SeedCriteriaSettingsValidator ( ) ) ;
2015-04-14 04:30:02 +00:00
}
}
2017-06-12 12:47:05 +00:00
public class HDBitsSettings : ITorrentIndexerSettings
2015-04-14 04:30:02 +00:00
{
2015-05-24 22:47:48 +00:00
private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator ( ) ;
2015-04-14 04:30:02 +00:00
2015-05-24 22:47:48 +00:00
public HDBitsSettings ( )
2015-04-14 04:30:02 +00:00
{
BaseUrl = "https://hdbits.org" ;
2017-06-12 12:47:05 +00:00
MinimumSeeders = IndexerDefaults . MINIMUM_SEEDERS ;
2017-05-29 15:56:16 +00:00
Categories = new int [ ] { ( int ) HdBitsCategory . Movie } ;
Codecs = new int [ 0 ] ;
Mediums = new int [ 0 ] ;
2019-10-14 21:47:23 +00:00
MultiLanguages = new List < int > ( ) ;
2019-10-18 03:06:01 +00:00
RequiredFlags = new List < int > ( ) ;
2015-04-14 04:30:02 +00:00
}
[FieldDefinition(0, Label = "Username")]
public string Username { get ; set ; }
2019-12-22 21:24:11 +00:00
2019-06-14 03:54:25 +00:00
//[FieldDefinition(1, Type = FieldType.Tag, SelectOptions = typeof(Language), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
2018-08-05 14:28:05 +00:00
public IEnumerable < int > MultiLanguages { get ; set ; }
2015-04-14 04:30:02 +00:00
2018-08-05 14:28:05 +00:00
[FieldDefinition(2, Label = "API Key")]
2015-04-14 04:30:02 +00:00
public string ApiKey { get ; set ; }
2018-08-05 14:28:05 +00:00
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
2015-04-14 04:30:02 +00:00
public string BaseUrl { get ; set ; }
2018-08-05 14:28:05 +00:00
[FieldDefinition(4, Label = "Categories", Type = FieldType.Tag, SelectOptions = typeof(HdBitsCategory), Advanced = true, HelpText = "Options: Movie, TV, Documentary, Music, Sport, Audio, XXX, MiscDemo. If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Categories { get ; set ; }
2018-08-05 14:28:05 +00:00
[FieldDefinition(5, Label = "Codecs", Type = FieldType.Tag, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Codecs { get ; set ; }
2018-08-05 14:28:05 +00:00
[FieldDefinition(6, Label = "Mediums", Type = FieldType.Tag, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Mediums { get ; set ; }
2018-11-23 07:03:32 +00:00
[FieldDefinition(7, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
2017-06-12 12:47:05 +00:00
public int MinimumSeeders { get ; set ; }
2018-05-27 09:05:23 +00:00
2019-10-18 03:06:01 +00:00
// [FieldDefinition(8, 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
2019-06-14 03:54:25 +00:00
[FieldDefinition(9)]
2020-01-07 03:02:41 +00:00
public SeedCriteriaSettings SeedCriteria { get ; set ; } = new SeedCriteriaSettings ( ) ;
2019-06-14 03:54:25 +00:00
2015-04-14 04:30:02 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
}
public enum HdBitsCategory
{
Movie = 1 ,
Tv = 2 ,
Documentary = 3 ,
Music = 4 ,
Sport = 5 ,
Audio = 6 ,
Xxx = 7 ,
MiscDemo = 8
}
public enum HdBitsCodec
{
H264 = 1 ,
Mpeg2 = 2 ,
Vc1 = 3 ,
2017-10-07 17:57:09 +00:00
Xvid = 4 ,
HEVC = 5
2015-04-14 04:30:02 +00:00
}
public enum HdBitsMedium
{
Bluray = 1 ,
Encode = 3 ,
Capture = 4 ,
Remux = 5 ,
WebDl = 6
}
}