mirror of https://github.com/Radarr/Radarr
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Languages;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
{
|
|
public class OmgwtfnzbsSettingsValidator : AbstractValidator<OmgwtfnzbsSettings>
|
|
{
|
|
public OmgwtfnzbsSettingsValidator()
|
|
{
|
|
RuleFor(c => c.Username).NotEmpty();
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
RuleFor(c => c.Delay).GreaterThanOrEqualTo(0);
|
|
}
|
|
}
|
|
|
|
public class OmgwtfnzbsSettings : IIndexerSettings
|
|
{
|
|
private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator();
|
|
|
|
public OmgwtfnzbsSettings()
|
|
{
|
|
Delay = 30;
|
|
MultiLanguages = new List<int>();
|
|
}
|
|
|
|
// Unused since Omg has a hardcoded url.
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
|
public string Username { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
|
|
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; }
|
|
|
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
|
public IEnumerable<int> MultiLanguages { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|