parent
44d8dbaac8
commit
d484553b31
|
@ -543,6 +543,52 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
|||
result.HasWarnings.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_test_success_if_sorters_are_empty()
|
||||
{
|
||||
_config.Misc.enable_tv_sorting = false;
|
||||
_config.Misc.tv_categories = null;
|
||||
_config.Sorters = new List<SabnzbdSorter>();
|
||||
|
||||
var result = new NzbDroneValidationResult(Subject.Test());
|
||||
|
||||
result.IsValid.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_test_failed_if_sorter_is_enabled_for_non_tv_category()
|
||||
{
|
||||
_config.Misc.enable_tv_sorting = false;
|
||||
_config.Misc.tv_categories = null;
|
||||
_config.Sorters = Builder<SabnzbdSorter>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(s => s.is_active = true)
|
||||
.With(s => s.sort_cats = new List<string> { "tv-custom" })
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
var result = new NzbDroneValidationResult(Subject.Test());
|
||||
|
||||
result.IsValid.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_test_failed_if_sorter_is_enabled_for_tv_category()
|
||||
{
|
||||
_config.Misc.enable_tv_sorting = false;
|
||||
_config.Misc.tv_categories = null;
|
||||
_config.Sorters = Builder<SabnzbdSorter>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(s => s.is_active = true)
|
||||
.With(s => s.sort_cats = new List<string> { "tv" })
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
var result = new NzbDroneValidationResult(Subject.Test());
|
||||
|
||||
result.IsValid.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_test_success_if_tv_sorting_disabled()
|
||||
{
|
||||
|
|
|
@ -482,6 +482,16 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
|||
}
|
||||
}
|
||||
|
||||
// New in SABnzbd 4.1, but on older versions this will be empty and not apply
|
||||
if (config.Sorters.Any(s => s.is_active && ContainsCategory(s.sort_cats, Settings.TvCategory)))
|
||||
{
|
||||
return new NzbDroneValidationFailure("TvCategory", "Disable TV Sorting")
|
||||
{
|
||||
InfoLink = _proxy.GetBaseUrl(Settings, "config/sorting/"),
|
||||
DetailedDescription = "You must disable sorting for the category Sonarr uses to prevent import issues. Go to Sabnzbd to fix it."
|
||||
};
|
||||
}
|
||||
|
||||
if (config.Misc.enable_tv_sorting && ContainsCategory(config.Misc.tv_categories, Settings.TvCategory))
|
||||
{
|
||||
return new NzbDroneValidationFailure("TvCategory", "Disable TV Sorting")
|
||||
|
|
|
@ -11,11 +11,13 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
|||
{
|
||||
Categories = new List<SabnzbdCategory>();
|
||||
Servers = new List<object>();
|
||||
Sorters = new List<SabnzbdSorter>();
|
||||
}
|
||||
|
||||
public SabnzbdConfigMisc Misc { get; set; }
|
||||
public List<SabnzbdCategory> Categories { get; set; }
|
||||
public List<object> Servers { get; set; }
|
||||
public List<SabnzbdSorter> Sorters { get; set; }
|
||||
}
|
||||
|
||||
public class SabnzbdConfigMisc
|
||||
|
@ -42,4 +44,22 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
|||
|
||||
public OsPath FullPath { get; set; }
|
||||
}
|
||||
|
||||
public class SabnzbdSorter
|
||||
{
|
||||
public SabnzbdSorter()
|
||||
{
|
||||
sort_cats = new List<string>();
|
||||
sort_type = new List<int>();
|
||||
}
|
||||
|
||||
public string name { get; set; }
|
||||
public int order { get; set; }
|
||||
public string min_size { get; set; }
|
||||
public string multipart_label { get; set; }
|
||||
public string sort_string { get; set; }
|
||||
public List<string> sort_cats { get; set; }
|
||||
public List<int> sort_type { get; set; }
|
||||
public bool is_active { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue