mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Metasearch , fix for empty queries being converted to a single space, parent categories are now autoexpanded.
This commit is contained in:
@@ -47,6 +47,11 @@ namespace Jackett.Models
|
||||
Categories = new int[0];
|
||||
}
|
||||
|
||||
public string GetQueryString()
|
||||
{
|
||||
return (SanitizedSearchTerm + " " + GetEpisodeSearchString()).Trim();
|
||||
}
|
||||
|
||||
public string GetEpisodeSearchString()
|
||||
{
|
||||
if (Season == 0)
|
||||
@@ -118,5 +123,24 @@ namespace Jackett.Models
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
public void ExpandCatsToSubCats()
|
||||
{
|
||||
if (Categories.Count() == 0)
|
||||
return;
|
||||
var newCatList = new List<int>();
|
||||
newCatList.AddRange(Categories);
|
||||
foreach (var cat in Categories)
|
||||
{
|
||||
var majorCat = TorznabCatType.AllCats.Where(c => c.ID == cat).FirstOrDefault();
|
||||
// If we search for TV we should also search for all sub cats
|
||||
if (majorCat != null)
|
||||
{
|
||||
newCatList.AddRange(majorCat.SubCategories.Select(s => s.ID));
|
||||
}
|
||||
}
|
||||
|
||||
Categories = newCatList.Distinct().ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user