mirror of https://github.com/Sonarr/Sonarr
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Equ;
|
|
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Languages;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Indexers.Fanzub
|
|
{
|
|
public class FanzubSettingsValidator : AbstractValidator<FanzubSettings>
|
|
{
|
|
public FanzubSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
}
|
|
}
|
|
|
|
public class FanzubSettings : PropertywiseEquatable<FanzubSettings>, IIndexerSettings
|
|
{
|
|
private static readonly FanzubSettingsValidator Validator = new ();
|
|
|
|
public FanzubSettings()
|
|
{
|
|
BaseUrl = "http://fanzub.com/rss/";
|
|
MultiLanguages = Array.Empty<int>();
|
|
}
|
|
|
|
[FieldDefinition(0, Label = "IndexerSettingsRssUrl", HelpText = "IndexerSettingsRssUrlHelpText")]
|
|
[FieldToken(TokenField.HelpText, "IndexerSettingsRssUrl", "indexer", "Fanzub")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "IndexerSettingsAnimeStandardFormatSearch", Type = FieldType.Checkbox, HelpText = "IndexerSettingsAnimeStandardFormatSearchHelpText")]
|
|
public bool AnimeStandardFormatSearch { get; set; }
|
|
|
|
[FieldDefinition(2, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
|
public IEnumerable<int> MultiLanguages { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|