2014-05-13 17:57:46 +00:00
|
|
|
|
using FluentValidation;
|
|
|
|
|
using System;
|
|
|
|
|
using NzbDrone.Core.Annotations;
|
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
2015-03-17 04:33:34 +00:00
|
|
|
|
using NzbDrone.Core.Validation;
|
2014-05-13 17:57:46 +00:00
|
|
|
|
using NzbDrone.Core.Validation.Paths;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download.Clients.TorrentBlackhole
|
|
|
|
|
{
|
|
|
|
|
public class TorrentBlackholeSettingsValidator : AbstractValidator<TorrentBlackholeSettings>
|
|
|
|
|
{
|
|
|
|
|
public TorrentBlackholeSettingsValidator()
|
|
|
|
|
{
|
|
|
|
|
//Todo: Validate that the path actually exists
|
|
|
|
|
RuleFor(c => c.TorrentFolder).IsValidPath();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TorrentBlackholeSettings : IProviderConfig
|
|
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
|
private static readonly TorrentBlackholeSettingsValidator Validator = new TorrentBlackholeSettingsValidator();
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
2015-03-10 21:00:47 +00:00
|
|
|
|
[FieldDefinition(0, Label = "Torrent Folder", Type = FieldType.Path, HelpText = "Folder in which Sonarr will store the .torrent file")]
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string TorrentFolder { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
2015-03-10 21:00:47 +00:00
|
|
|
|
[FieldDefinition(1, Label = "Watch Folder", Type = FieldType.Path, HelpText = "Folder from which Sonarr should import completed downloads")]
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string WatchFolder { get; set; }
|
2014-05-13 17:57:46 +00:00
|
|
|
|
|
2015-03-17 04:33:34 +00:00
|
|
|
|
public NzbDroneValidationResult Validate()
|
2014-05-13 17:57:46 +00:00
|
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
2014-05-13 17:57:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|