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

Loading…
Cancel
Save