Add codec and medium filters to HDBits API (#7209)

* Add codec and medium filters to HDBits API

* Add checkboxes support to CardigannIndexer

* Expose multi-select as template variable

* update datestamp to force cache refresh

Co-authored-by: garfield69 <garfield69@outlook.com>
This commit is contained in:
Jonas Stendahl
2020-02-19 21:23:55 +01:00
committed by GitHub
parent 49d4c3248c
commit 950d38a651
9 changed files with 161 additions and 26 deletions

View File

@@ -118,6 +118,14 @@ namespace Jackett.Common.Indexers
case "text":
item = new StringItem { Value = Setting.Default };
break;
case "multi-select":
if (Setting.Options == null)
{
throw new Exception("Options must be given for the 'multi-select' type.");
}
item = new CheckboxItem(Setting.Options) { Values = Setting.Defaults };
break;
case "select":
if (Setting.Options == null)
{
@@ -201,21 +209,30 @@ namespace Jackett.Common.Indexers
variables[".Config.sitelink"] = SiteLink;
foreach (var Setting in Definition.Settings)
{
string value;
var item = configData.GetDynamic(Setting.Name);
if (item.GetType() == typeof(BoolItem))
// CheckBox item is an array of strings
if (item.GetType() == typeof(CheckboxItem))
{
value = (((BoolItem)item).Value == true ? "true" : "");
}
else if (item.GetType() == typeof(SelectItem))
{
value = ((SelectItem)item).Value;
variables[".Config." + Setting.Name] = ((CheckboxItem)item).Values;
}
else
{
value = ((StringItem)item).Value;
string value;
if (item.GetType() == typeof(BoolItem))
{
value = (((BoolItem)item).Value == true ? "true" : "");
}
else if (item.GetType() == typeof(SelectItem))
{
value = ((SelectItem)item).Value;
}
else
{
value = ((StringItem)item).Value;
}
variables[".Config." + Setting.Name] = value;
}
variables[".Config." + Setting.Name] = value;
}
return variables;
}
@@ -1235,7 +1252,7 @@ namespace Jackett.Common.Indexers
variables[".Query.Keywords"] = string.Join(" ", KeywordTokens);
variables[".Keywords"] = applyFilters((string)variables[".Query.Keywords"], Search.Keywordsfilters);
// TODO: prepare queries first and then send them parallel
// TODO: prepare queries first and then send them parallel
var SearchPaths = Search.Paths;
foreach (var SearchPath in SearchPaths)
{