2023-12-04 10:53:33 +00:00
using System ;
2020-01-25 22:49:40 +00:00
using System.Collections.Generic ;
using FluentValidation ;
using NzbDrone.Core.Annotations ;
2020-04-11 04:26:09 +00:00
using NzbDrone.Core.Languages ;
2020-01-25 22:49:40 +00:00
using NzbDrone.Core.Parser.Model ;
using NzbDrone.Core.Validation ;
namespace NzbDrone.Core.Indexers.FileList
{
public class FileListSettingsValidator : AbstractValidator < FileListSettings >
{
public FileListSettingsValidator ( )
{
RuleFor ( c = > c . BaseUrl ) . ValidRootUrl ( ) ;
RuleFor ( c = > c . Username ) . NotEmpty ( ) ;
RuleFor ( c = > c . Passkey ) . NotEmpty ( ) ;
RuleFor ( c = > c . SeedCriteria ) . SetValidator ( _ = > new SeedCriteriaSettingsValidator ( ) ) ;
}
}
public class FileListSettings : ITorrentIndexerSettings
{
private static readonly FileListSettingsValidator Validator = new FileListSettingsValidator ( ) ;
public FileListSettings ( )
{
2020-10-04 05:17:26 +00:00
BaseUrl = "https://filelist.io" ;
2020-01-25 22:49:40 +00:00
MinimumSeeders = IndexerDefaults . MINIMUM_SEEDERS ;
2023-12-04 10:53:33 +00:00
Categories = new [ ]
2020-10-07 03:03:29 +00:00
{
( int ) FileListCategories . Movie_HD ,
( int ) FileListCategories . Movie_SD ,
( int ) FileListCategories . Movie_4K
} ;
2023-12-04 10:53:33 +00:00
MultiLanguages = Array . Empty < int > ( ) ;
RequiredFlags = Array . Empty < int > ( ) ;
2020-01-25 22:49:40 +00:00
}
2020-10-17 03:27:01 +00:00
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
2020-01-25 22:49:40 +00:00
public string Username { get ; set ; }
2020-10-17 03:27:01 +00:00
[FieldDefinition(1, Label = "Passkey", Privacy = PrivacyLevel.ApiKey)]
2020-01-25 22:49:40 +00:00
public string Passkey { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(2, 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.")]
2020-01-25 22:49:40 +00:00
public string BaseUrl { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(3, Label = "Categories", Type = FieldType.Select, SelectOptions = typeof(FileListCategories), HelpText = "Categories for use in search and feeds. If unspecified, all options are used.")]
2020-01-25 22:49:40 +00:00
public IEnumerable < int > Categories { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
2020-01-25 22:49:40 +00:00
public int MinimumSeeders { get ; set ; }
2024-04-16 03:24:05 +00:00
[FieldDefinition(5)]
2020-01-25 22:49:40 +00:00
public SeedCriteriaSettings SeedCriteria { get ; set ; } = new SeedCriteriaSettings ( ) ;
2024-04-16 03:24:05 +00:00
[FieldDefinition(6, 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(7, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
public IEnumerable < int > MultiLanguages { get ; set ; }
[FieldDefinition(8, 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 ; }
2020-01-25 22:49:40 +00:00
public NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
}
public enum FileListCategories
{
2023-04-23 04:04:41 +00:00
[FieldOption("Movies SD")]
2020-01-25 22:49:40 +00:00
Movie_SD = 1 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies DVD")]
2020-01-25 22:49:40 +00:00
Movie_DVD = 2 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies DVD-RO")]
2020-01-25 22:49:40 +00:00
Movie_DVDRO = 3 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies HD")]
2020-01-25 22:49:40 +00:00
Movie_HD = 4 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies HD-RO")]
2020-01-25 22:49:40 +00:00
Movie_HDRO = 19 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies 4K")]
Movie_4K = 6 ,
[FieldOption("Movies Blu-Ray")]
2020-01-25 22:49:40 +00:00
Movie_BluRay = 20 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies 4K Blu-Ray")]
2020-01-25 22:49:40 +00:00
Movie_BluRay4K = 26 ,
2023-04-23 04:04:41 +00:00
[FieldOption("Movies 3D")]
2020-01-25 22:49:40 +00:00
Movie_3D = 25 ,
2023-04-23 04:04:41 +00:00
[FieldOption("XXX")]
2020-01-25 22:49:40 +00:00
Xxx = 7
}
}