mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
This commit is contained in:
@@ -229,17 +229,65 @@ namespace Jackett.Common.Indexers
|
|||||||
[".False"] = null,
|
[".False"] = null,
|
||||||
[".Today.Year"] = DateTime.Today.Year.ToString()
|
[".Today.Year"] = DateTime.Today.Year.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var setting in Definition.Settings)
|
foreach (var setting in Definition.Settings)
|
||||||
variables[".Config." + setting.Name] = configData.GetDynamic(setting.Name) switch
|
{
|
||||||
|
var configurationItem = configData.GetDynamic(setting.Name);
|
||||||
|
if (configurationItem == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var variableKey = ".Config." + setting.Name;
|
||||||
|
|
||||||
|
switch (configurationItem)
|
||||||
{
|
{
|
||||||
MultiSelectConfigurationItem checkbox => checkbox.Values,
|
case BoolConfigurationItem boolItem:
|
||||||
BoolConfigurationItem boolItem => variables[boolItem.Value ? ".True" : ".False"],
|
{
|
||||||
SingleSelectConfigurationItem selectItem => selectItem.Value,
|
variables[variableKey] = variables[boolItem.Value ? ".True" : ".False"];
|
||||||
StringConfigurationItem stringItem => stringItem.Value,
|
break;
|
||||||
// Throw exception here to match original functionality.
|
}
|
||||||
// Currently this will only throw for ImageItem.
|
case StringConfigurationItem stringItem:
|
||||||
_ => throw new NotSupportedException()
|
{
|
||||||
};
|
variables[variableKey] = stringItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PasswordConfigurationItem passwordItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = passwordItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SingleSelectConfigurationItem selectItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = selectItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MultiSelectConfigurationItem multiSelectItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = multiSelectItem.Values;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DisplayImageConfigurationItem displayImageItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = displayImageItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DisplayInfoConfigurationItem displayInfoItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = displayInfoItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HiddenStringConfigurationItem hiddenStringItem:
|
||||||
|
{
|
||||||
|
variables[variableKey] = hiddenStringItem.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//TODO Should this throw a NotSupportedException, as it used to?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user