2023-11-14 13:13:45 +00:00
using System ;
2019-12-22 22:08:53 +00:00
using System.Collections.Generic ;
2024-04-14 04:16:26 +00:00
using Equ ;
2017-05-29 15:56:16 +00:00
using FluentValidation ;
2015-05-24 22:47:48 +00:00
using NzbDrone.Core.Annotations ;
2020-04-11 04:26:09 +00:00
using NzbDrone.Core.Languages ;
2020-01-07 04:31:33 +00:00
using NzbDrone.Core.Parser.Model ;
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
}
}
2024-04-14 04:16:26 +00:00
public class HDBitsSettings : PropertywiseEquatable < HDBitsSettings > , ITorrentIndexerSettings
2015-04-14 04:30:02 +00:00
{
2023-11-14 13:13:45 +00:00
private static readonly HDBitsSettingsValidator Validator = new ( ) ;
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
2023-11-14 13:13:45 +00:00
Categories = new [ ] { ( int ) HdBitsCategory . Movie } ;
Codecs = Array . Empty < int > ( ) ;
Mediums = Array . Empty < int > ( ) ;
2023-12-04 10:53:33 +00:00
MultiLanguages = Array . Empty < int > ( ) ;
RequiredFlags = Array . Empty < int > ( ) ;
2015-04-14 04:30:02 +00:00
}
2023-11-14 13:13:45 +00:00
[FieldDefinition(0, 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.")]
public string BaseUrl { get ; set ; }
2019-12-22 21:24:11 +00:00
2023-11-14 13:13:45 +00:00
[FieldDefinition(1, Label = "Username", Privacy = PrivacyLevel.UserName)]
public string Username { get ; set ; }
2015-04-14 04:30:02 +00:00
2020-10-17 03:27:01 +00:00
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
2015-04-14 04:30:02 +00:00
public string ApiKey { get ; set ; }
2023-11-14 15:13:34 +00:00
[FieldDefinition(3, Label = "Categories", Type = FieldType.Select, SelectOptions = typeof(HdBitsCategory), HelpText = "If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Categories { get ; set ; }
2023-11-14 15:13:34 +00:00
[FieldDefinition(4, Label = "Codecs", Type = FieldType.Select, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Codecs { get ; set ; }
2023-11-14 15:13:34 +00:00
[FieldDefinition(5, Label = "Mediums", Type = FieldType.Select, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "If unspecified, all options are used.")]
2017-05-29 15:56:16 +00:00
public IEnumerable < int > Mediums { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(6, 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
2024-04-16 03:24:05 +00:00
[FieldDefinition(7)]
2023-11-14 13:13:45 +00:00
public SeedCriteriaSettings SeedCriteria { get ; set ; } = new ( ) ;
2019-06-14 03:54:25 +00:00
2024-04-16 03:24:05 +00:00
[FieldDefinition(8, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
2023-10-29 18:23:23 +00:00
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(9, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
public IEnumerable < int > MultiLanguages { get ; set ; }
[FieldDefinition(10, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
public IEnumerable < int > RequiredFlags { get ; set ; }
2015-04-14 04:30:02 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
}
public enum HdBitsCategory
{
2023-11-14 15:13:34 +00:00
[FieldOption("Movie")]
2015-04-14 04:30:02 +00:00
Movie = 1 ,
2023-11-14 15:13:34 +00:00
[FieldOption("TV")]
2015-04-14 04:30:02 +00:00
Tv = 2 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Documentary")]
2015-04-14 04:30:02 +00:00
Documentary = 3 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Music")]
2015-04-14 04:30:02 +00:00
Music = 4 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Sport")]
2015-04-14 04:30:02 +00:00
Sport = 5 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Audio Track")]
2015-04-14 04:30:02 +00:00
Audio = 6 ,
2023-11-14 15:13:34 +00:00
[FieldOption("XXX")]
2015-04-14 04:30:02 +00:00
Xxx = 7 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Misc/Demo")]
2015-04-14 04:30:02 +00:00
MiscDemo = 8
}
public enum HdBitsCodec
{
2023-11-14 15:13:34 +00:00
[FieldOption("H.264")]
2015-04-14 04:30:02 +00:00
H264 = 1 ,
2023-11-14 15:13:34 +00:00
[FieldOption("MPEG-2")]
2015-04-14 04:30:02 +00:00
Mpeg2 = 2 ,
2023-11-14 15:13:34 +00:00
[FieldOption("VC-1")]
2015-04-14 04:30:02 +00:00
Vc1 = 3 ,
2023-11-14 15:13:34 +00:00
[FieldOption("XviD")]
2017-10-07 17:57:09 +00:00
Xvid = 4 ,
2023-11-14 15:13:34 +00:00
[FieldOption("HEVC")]
2017-10-07 17:57:09 +00:00
HEVC = 5
2015-04-14 04:30:02 +00:00
}
public enum HdBitsMedium
{
2023-11-14 15:13:34 +00:00
[FieldOption("Blu-ray/HD DVD")]
2015-04-14 04:30:02 +00:00
Bluray = 1 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Encode")]
2015-04-14 04:30:02 +00:00
Encode = 3 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Capture")]
2015-04-14 04:30:02 +00:00
Capture = 4 ,
2023-11-14 15:13:34 +00:00
[FieldOption("Remux")]
2015-04-14 04:30:02 +00:00
Remux = 5 ,
2023-11-14 15:13:34 +00:00
[FieldOption("WEB-DL")]
2015-04-14 04:30:02 +00:00
WebDl = 6
}
}