You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|
{
|
|
public class BroadcastheNetSettingsValidator : AbstractValidator<BroadcastheNetSettings>
|
|
{
|
|
public BroadcastheNetSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class BroadcastheNetSettings : IProviderConfig
|
|
{
|
|
private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator();
|
|
|
|
public BroadcastheNetSettings()
|
|
{
|
|
BaseUrl = "http://api.broadcasthe.net/";
|
|
}
|
|
|
|
[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; }
|
|
|
|
[FieldDefinition(1, Label = "API Key")]
|
|
public string ApiKey { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|