You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.0 KiB
52 lines
2.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.ImportLists.Lidarr
|
|
{
|
|
public class LidarrSettingsValidator : AbstractValidator<LidarrSettings>
|
|
{
|
|
public LidarrSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class LidarrSettings : IImportListSettings
|
|
{
|
|
private static readonly LidarrSettingsValidator Validator = new LidarrSettingsValidator();
|
|
|
|
public LidarrSettings()
|
|
{
|
|
BaseUrl = "";
|
|
ApiKey = "";
|
|
ProfileIds = Array.Empty<int>();
|
|
TagIds = Array.Empty<int>();
|
|
RootFolderPaths = Array.Empty<string>();
|
|
}
|
|
|
|
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Lidarr instance to import from")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "Apikey of the Lidarr instance to import from")]
|
|
public string ApiKey { get; set; }
|
|
|
|
[FieldDefinition(2, Type = FieldType.Select, SelectOptionsProviderAction = "getProfiles", Label = "Profiles", HelpText = "Profiles from the source instance to import from")]
|
|
public IEnumerable<int> ProfileIds { get; set; }
|
|
|
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "Tags from the source instance to import from")]
|
|
public IEnumerable<int> TagIds { get; set; }
|
|
|
|
[FieldDefinition(4, Type = FieldType.Select, SelectOptionsProviderAction = "getRootFolders", Label = "Root Folders", HelpText = "Root Folders from the source instance to import from")]
|
|
public IEnumerable<string> RootFolderPaths { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|