mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
cardigann: respect the categories from search paths (#14395)
This commit is contained in:
@@ -1349,8 +1349,6 @@ namespace Jackett.Common.Indexers
|
|||||||
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)
|
||||||
@@ -1369,17 +1367,28 @@ namespace Jackett.Common.Indexers
|
|||||||
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.Count > 0)
|
if (SearchPath.Categories.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
|
||||||
// HttpUtility.UrlPathEncode seems to only encode spaces, we use UrlEncode and replace + with %20 as a workaround
|
// HttpUtility.UrlPathEncode seems to only encode spaces, we use UrlEncode and replace + with %20 as a workaround
|
||||||
var searchUrl = resolvePath(applyGoTemplateText(SearchPath.Path, variables, WebUtility.UrlEncode).Replace("+", "%20")).AbsoluteUri;
|
var searchUrl = resolvePath(applyGoTemplateText(SearchPath.Path, variables, WebUtility.UrlEncode).Replace("+", "%20")).AbsoluteUri;
|
||||||
|
Reference in New Issue
Block a user