2018-04-15 03:03:32 +00:00
|
|
|
using FluentValidation;
|
2014-05-13 17:57:46 +00:00
|
|
|
using NzbDrone.Core.Annotations;
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
2015-03-17 04:33:34 +00:00
|
|
|
using NzbDrone.Core.Validation;
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download.Clients.Deluge
|
|
|
|
{
|
|
|
|
public class DelugeSettingsValidator : AbstractValidator<DelugeSettings>
|
|
|
|
{
|
|
|
|
public DelugeSettingsValidator()
|
|
|
|
{
|
2015-03-31 21:52:27 +00:00
|
|
|
RuleFor(c => c.Host).ValidHost();
|
2017-01-27 06:35:16 +00:00
|
|
|
RuleFor(c => c.Port).InclusiveBetween(1, 65535);
|
2014-05-13 17:57:46 +00:00
|
|
|
|
2019-10-29 02:40:36 +00:00
|
|
|
RuleFor(c => c.MovieCategory).Matches("^[-a-z0-9]*$").WithMessage("Allowed characters a-z, 0-9 and -");
|
|
|
|
RuleFor(c => c.MovieImportedCategory).Matches("^[-a-z0-9]*$").WithMessage("Allowed characters a-z, 0-9 and -");
|
2014-05-13 17:57:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class DelugeSettings : IProviderConfig
|
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
private static readonly DelugeSettingsValidator Validator = new DelugeSettingsValidator();
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
|
|
public DelugeSettings()
|
|
|
|
{
|
|
|
|
Host = "localhost";
|
|
|
|
Port = 8112;
|
|
|
|
Password = "deluge";
|
2017-02-13 01:07:57 +00:00
|
|
|
MovieCategory = "radarr";
|
2014-05-13 17:57:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
|
2015-10-03 17:45:26 +00:00
|
|
|
public string Host { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
|
|
[FieldDefinition(1, Label = "Port", Type = FieldType.Textbox)]
|
2015-10-03 17:45:26 +00:00
|
|
|
public int Port { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(2, Label = "UseSsl", Type = FieldType.Checkbox, HelpText = "DownloadClientSettingsUseSslHelpText")]
|
|
|
|
[FieldToken(TokenField.HelpText, "UseSsl", "clientName", "Deluge")]
|
2021-03-08 22:59:11 +00:00
|
|
|
public bool UseSsl { get; set; }
|
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(3, Label = "UrlBase", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientDelugeSettingsUrlBaseHelpText")]
|
|
|
|
[FieldToken(TokenField.HelpText, "UrlBase", "url", "http://[host]:[port]/[urlBase]/json")]
|
2015-10-03 17:45:26 +00:00
|
|
|
public string UrlBase { get; set; }
|
2015-03-08 14:37:33 +00:00
|
|
|
|
2021-03-08 22:59:11 +00:00
|
|
|
[FieldDefinition(4, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
|
2015-10-03 17:45:26 +00:00
|
|
|
public string Password { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(5, Label = "Category", Type = FieldType.Textbox, HelpText = "DownloadClientSettingsCategoryHelpText")]
|
2017-01-13 16:08:36 +00:00
|
|
|
public string MovieCategory { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(6, Label = "PostImportCategory", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientSettingsPostImportCategoryHelpText")]
|
2019-07-01 01:50:01 +00:00
|
|
|
public string MovieImportedCategory { get; set; }
|
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(7, Label = "DownloadClientSettingsRecentPriority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "DownloadClientSettingsRecentPriorityMovieHelpText")]
|
2018-04-15 03:03:32 +00:00
|
|
|
public int RecentMoviePriority { get; set; }
|
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(8, Label = "DownloadClientSettingsOlderPriority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "DownloadClientSettingsOlderPriorityMovieHelpText")]
|
2018-04-15 03:03:32 +00:00
|
|
|
public int OlderMoviePriority { get; set; }
|
|
|
|
|
2023-11-10 16:44:04 +00:00
|
|
|
[FieldDefinition(9, Label = "DownloadClientSettingsAddPaused", Type = FieldType.Checkbox)]
|
2018-09-18 15:24:55 +00:00
|
|
|
public bool AddPaused { get; set; }
|
|
|
|
|
2024-03-03 10:23:22 +00:00
|
|
|
[FieldDefinition(10, Label = "DownloadClientDelugeSettingsDirectory", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientDelugeSettingsDirectoryHelpText")]
|
|
|
|
public string DownloadDirectory { get; set; }
|
|
|
|
|
|
|
|
[FieldDefinition(11, Label = "DownloadClientDelugeSettingsDirectoryCompleted", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientDelugeSettingsDirectoryCompletedHelpText")]
|
|
|
|
public string CompletedDirectory { get; set; }
|
|
|
|
|
2015-03-17 04:33:34 +00:00
|
|
|
public NzbDroneValidationResult Validate()
|
2014-05-13 17:57:46 +00:00
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
2014-05-13 17:57:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|