Cleanup SearchCriteria, Pass Cats from Search to Indexers

This commit is contained in:
Qstick
2020-11-18 15:35:14 -05:00
parent 529102ebcf
commit 6100adc515
25 changed files with 89 additions and 176 deletions
@@ -82,15 +82,10 @@ namespace NzbDrone.Core.Indexers.Newznab
};
}
private NewznabSettings GetSettings(string url, string apiPath = null, int[] categories = null)
private NewznabSettings GetSettings(string url, string apiPath = null)
{
var settings = new NewznabSettings { BaseUrl = url };
if (categories != null)
{
settings.Categories = categories;
}
if (apiPath.IsNotNullOrWhiteSpace())
{
settings.ApiPath = apiPath;
@@ -123,17 +118,6 @@ namespace NzbDrone.Core.Indexers.Newznab
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
var notSupported = Settings.Categories.Except(CategoryIds(capabilities.Categories));
if (notSupported.Any())
{
_logger.Warn($"{Definition.Name} does not support the following categories: {string.Join(", ", notSupported)}. You should probably remove them.");
if (notSupported.Count() == Settings.Categories.Count())
{
return new ValidationFailure(string.Empty, $"This indexer does not support any of the selected categories! (You may need to turn on advanced settings to see them)");
}
}
if (capabilities.SearchParams != null && capabilities.SearchParams.Contains(SearchParam.Q))
{
return null;