cardigannIndexer: add validate field filter

will mostly be used with sites that used tags, to remove the non-genre chaff from the genre field.
This commit is contained in:
Garfield69 2022-07-31 20:23:30 +12:00
parent f90186a648
commit a8b1001e91
2 changed files with 9 additions and 1 deletions

View File

@ -796,7 +796,7 @@
"properties": {
"name": {
"type": "string",
"enum": ["querystring", "timeparse", "dateparse", "regexp", "re_replace", "split", "replace", "trim", "prepend", "append", "tolower", "toupper", "urldecode", "urlencode", "timeago", "reltime", "fuzzytime", "validfilename", "diacritics", "jsonjoinarray", "hexdump", "strdump"]
"enum": ["querystring", "timeparse", "dateparse", "regexp", "re_replace", "split", "replace", "trim", "prepend", "append", "tolower", "toupper", "urldecode", "urlencode", "timeago", "reltime", "fuzzytime", "validfilename", "diacritics", "jsonjoinarray", "hexdump", "strdump", "validate"]
},
"args": {
"oneOf": [

View File

@ -1129,6 +1129,14 @@ namespace Jackett.Common.Indexers
strTag = ":";
logger.Debug(string.Format("CardigannIndexer ({0}): strdump{1} {2}", Id, strTag, DebugData));
break;
case "validate":
char[] delimiters = { ',', ' ', '/', ')', '(', '.' };
var args = (string)Filter.Args;
var argsList = args.ToLower().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries);
var validList = argsList.ToList();
var validIntersect = validList.Intersect(Data.ToLower().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries)).ToList();
Data = string.Join(", ", validIntersect);
break;
default:
break;
}