mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Implement Waffles Indexer (#34)
* Implement Waffles Indexer Implement Waffles Indexer * Remove Exception Class Remove Exception Class * Fix csproj file Fix csproj file * Add Test Fixture Add Test Fixture * Split line due to length for readability Split line due to length for readability
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Waffles
|
||||
{
|
||||
public class WafflesSettingsValidator : AbstractValidator<WafflesSettings>
|
||||
{
|
||||
public WafflesSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.UserId).NotEmpty();
|
||||
RuleFor(c => c.RssPasskey).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class WafflesSettings : IProviderConfig
|
||||
{
|
||||
private static readonly WafflesSettingsValidator Validator = new WafflesSettingsValidator();
|
||||
|
||||
public WafflesSettings()
|
||||
{
|
||||
BaseUrl = "https://www.waffles.ch";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "Website URL")]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "UserId")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[FieldDefinition(2, Label = "RSS Passkey")]
|
||||
public string RssPasskey { get; set; }
|
||||
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user