2015-05-24 18:41:12 +00:00
|
|
|
using System;
|
|
|
|
using FluentValidation;
|
|
|
|
using NzbDrone.Core.Annotations;
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
|
|
|
using NzbDrone.Core.Validation;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers.Rarbg
|
|
|
|
{
|
|
|
|
public class RarbgSettingsValidator : AbstractValidator<RarbgSettings>
|
|
|
|
{
|
|
|
|
public RarbgSettingsValidator()
|
|
|
|
{
|
|
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class RarbgSettings : IProviderConfig
|
|
|
|
{
|
|
|
|
private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator();
|
|
|
|
|
|
|
|
public RarbgSettings()
|
|
|
|
{
|
|
|
|
BaseUrl = "https://torrentapi.org";
|
|
|
|
RankedOnly = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
[FieldDefinition(0, Label = "API URL", HelpText = "URL to Rarbg api, not the website.")]
|
|
|
|
public string BaseUrl { get; set; }
|
|
|
|
|
2015-06-05 21:31:51 +00:00
|
|
|
[FieldDefinition(1, Type = FieldType.Checkbox, Label = "Ranked Only", HelpText = "Only include ranked results.")]
|
2015-05-24 18:41:12 +00:00
|
|
|
public bool RankedOnly { get; set; }
|
|
|
|
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
|
|
{
|
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|