2015-01-14 07:40:25 +00:00
|
|
|
|
using FluentValidation;
|
2013-05-03 05:24:52 +00:00
|
|
|
|
using NzbDrone.Core.Annotations;
|
2013-09-21 07:09:26 +00:00
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
2015-03-17 04:33:34 +00:00
|
|
|
|
using NzbDrone.Core.Validation;
|
2013-04-07 07:30:37 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
|
|
|
{
|
2013-08-26 04:01:03 +00:00
|
|
|
|
public class OmgwtfnzbsSettingsValidator : AbstractValidator<OmgwtfnzbsSettings>
|
|
|
|
|
{
|
|
|
|
|
public OmgwtfnzbsSettingsValidator()
|
|
|
|
|
{
|
|
|
|
|
RuleFor(c => c.Username).NotEmpty();
|
|
|
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
2015-01-14 07:40:25 +00:00
|
|
|
|
RuleFor(c => c.Delay).GreaterThanOrEqualTo(0);
|
2013-08-26 04:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-21 07:09:26 +00:00
|
|
|
|
public class OmgwtfnzbsSettings : IProviderConfig
|
2013-04-07 07:30:37 +00:00
|
|
|
|
{
|
2013-08-26 04:01:03 +00:00
|
|
|
|
private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator();
|
2013-08-22 08:08:43 +00:00
|
|
|
|
|
2015-01-14 07:40:25 +00:00
|
|
|
|
public OmgwtfnzbsSettings()
|
|
|
|
|
{
|
|
|
|
|
Delay = 30;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-29 07:06:25 +00:00
|
|
|
|
[FieldDefinition(0, Label = "Username")]
|
2015-01-14 07:40:25 +00:00
|
|
|
|
public string Username { get; set; }
|
2013-05-03 05:24:52 +00:00
|
|
|
|
|
2013-05-29 07:06:25 +00:00
|
|
|
|
[FieldDefinition(1, Label = "API Key")]
|
2015-01-14 07:40:25 +00:00
|
|
|
|
public string ApiKey { get; set; }
|
|
|
|
|
|
|
|
|
|
[FieldDefinition(2, Label = "Delay", HelpText = "Time in minutes to delay new nzbs before they appear on the RSS feed", Advanced = true)]
|
|
|
|
|
public int Delay { get; set; }
|
2013-04-07 07:30:37 +00:00
|
|
|
|
|
2015-03-17 04:33:34 +00:00
|
|
|
|
public NzbDroneValidationResult Validate()
|
2013-04-07 07:30:37 +00:00
|
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
2013-04-07 07:30:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|