Fixed: (Cardigann) Respect the categories from search paths

pull/1704/head
Bogdan 1 year ago
parent 59b6e8af27
commit ef1ad59f59

@ -1044,8 +1044,6 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
mappedCategories = _defaultCategories; mappedCategories = _defaultCategories;
} }
variables[".Categories"] = mappedCategories;
var keywordTokens = new List<string>(); var keywordTokens = new List<string>();
var keywordTokenKeys = new List<string> { "Q", "Series", "Movie", "Year" }; var keywordTokenKeys = new List<string> { "Q", "Series", "Movie", "Year" };
foreach (var key in keywordTokenKeys) foreach (var key in keywordTokenKeys)
@ -1069,20 +1067,26 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
var searchPaths = search.Paths; var searchPaths = search.Paths;
foreach (var searchPath in searchPaths) foreach (var searchPath in searchPaths)
{ {
variables[".Categories"] = mappedCategories;
// skip path if categories don't match // skip path if categories don't match
if (searchPath.Categories != null && mappedCategories.Count > 0) if (searchPath.Categories != null && mappedCategories.Count > 0)
{ {
var invertMatch = searchPath.Categories[0] == "!";
var hasIntersect = mappedCategories.Intersect(searchPath.Categories).Any(); var hasIntersect = mappedCategories.Intersect(searchPath.Categories).Any();
if (invertMatch)
if (searchPath.Categories[0] == "!")
{ {
hasIntersect = !hasIntersect; hasIntersect = !hasIntersect;
} }
if (!hasIntersect) if (!hasIntersect)
{ {
variables[".Categories"] = mappedCategories.Except(searchPath.Categories).ToList();
continue; continue;
} }
variables[".Categories"] = mappedCategories.Intersect(searchPath.Categories).ToList();
} }
// build search URL // build search URL

Loading…
Cancel
Save