Radarr/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs

40 lines
1.4 KiB
C#
Raw Normal View History

using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.TorrentRss
{
public class TorrentRssIndexerSettingsValidator : AbstractValidator<TorrentRssIndexerSettings>
{
public TorrentRssIndexerSettingsValidator()
{
RuleFor(c => c.BaseUrl).ValidRootUrl();
}
}
public class TorrentRssIndexerSettings : IProviderConfig
{
private static readonly TorrentRssIndexerSettingsValidator validator = new TorrentRssIndexerSettingsValidator();
public TorrentRssIndexerSettings()
{
BaseUrl = string.Empty;
AllowZeroSize = false;
}
[FieldDefinition(0, Label = "Full RSS Feed URL")]
public string BaseUrl { get; set; }
[FieldDefinition(1, Label = "Cookie", HelpText = "If you site requires a login cookie to access the rss, you'll have to retrieve it via a browser.")]
public string Cookie { get; set; }
[FieldDefinition(2, Type = FieldType.Checkbox, Label = "Allow Zero Size", HelpText="Enabling this will allow you to use feeds that don't specify release size, but be careful, size related checks will not be performed.")]
public bool AllowZeroSize { get; set; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(validator.Validate(this));
}
}
}