core: add custom cats in indexers with string categories. resolves #9746 (#10060)

* When category ids in the indexer are "strings" we create a unique hash to make it compatible with Torznab
* This PR also fix several issues related to custom cats
This commit is contained in:
Diego Heras
2020-11-02 01:42:00 +01:00
committed by GitHub
parent d2a7b59a8a
commit 1d7ea48505
9 changed files with 152 additions and 143 deletions

View File

@@ -266,16 +266,8 @@ namespace Jackett.Common.Indexers
if (query.Categories.Length == 0)
return results;
// TODO: move this code to TorznabCapabilitiesCategories and use indexer tree instead of general
// expand parent categories from the query
var expandedQueryCats = new List<int>();
foreach (var queryCategory in query.Categories)
{
expandedQueryCats.Add(queryCategory);
var parentCat = TorznabCatType.ParentCats.FirstOrDefault(c => c.ID == queryCategory);
if (parentCat != null)
expandedQueryCats.AddRange(parentCat.SubCategories.Select(c => c.ID));
}
var expandedQueryCats = TorznabCaps.Categories.ExpandTorznabQueryCategories(query);
var filteredResults = results.Where(result =>
result.Category?.Any() != true ||