mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Continue Test in case of validation warnings.
This commit is contained in:
parent
cab900f656
commit
eb2e7b9c79
@ -198,7 +198,7 @@ public override DownloadClientInfo GetStatus()
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestCategory());
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestOutputPath());
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ protected override string AddFromNzbFile(RemoteEpisode remoteEpisode, string fil
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestOutputPath());
|
||||
failures.AddIfNotNull(TestGetNZB());
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public override DownloadClientInfo GetStatus()
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ public override DownloadClientInfo GetStatus()
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestPrioritySupport());
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public override DownloadClientInfo GetStatus()
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
failures.AddIfNotNull(TestDirectory());
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public override DownloadClientInfo GetStatus()
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
@ -102,7 +103,7 @@ private NewznabSettings GetSettings(string url, string apiPath = null, int[] cat
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
base.Test(failures);
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestCapabilities());
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
using NzbDrone.Core.Indexers.Newznab;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Torznab
|
||||
{
|
||||
@ -91,7 +92,7 @@ private TorznabSettings GetSettings(string url, string apiPath = null, int[] cat
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
base.Test(failures);
|
||||
if (failures.Any()) return;
|
||||
if (failures.HasErrors()) return;
|
||||
failures.AddIfNotNull(TestCapabilities());
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
|
||||
namespace NzbDrone.Core.Validation
|
||||
{
|
||||
@ -19,5 +21,21 @@ public static void ThrowOnError(this NzbDroneValidationResult result)
|
||||
throw new ValidationException(result.Errors);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasErrors(this List<ValidationFailure> list)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var extended = item as NzbDroneValidationFailure;
|
||||
if (extended != null && extended.IsWarning)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user