cardigann: add search.allowEmptyInputs (#14088)

* cardigann: add `search.allowEmptyInputs`

* Update electro-torrent.yml

* Update gamestorrents.yml

* teamhd: take adv of default ignoreEmptyInputs

---------

Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com>
Co-authored-by: garfield69 <garfieldsixtynine@gmail.com>
This commit is contained in:
Bogdan
2023-03-20 18:18:28 +02:00
committed by GitHub
parent e59a904936
commit 8f24aceafb
9 changed files with 32 additions and 7 deletions

View File

@@ -31,10 +31,15 @@ settings:
search:
paths:
# https://github.com/anilibria/docs/blob/master/api_v3.md
- path: "https://api.anilibria.tv/v3/{{ if .Keywords }}searchTitles?search={{ .Keywords }}&{{ else }}getUpdates?{{ end }}filter=names,posters.small.url,code,torrents.list,season.year,description&limit=100"
- path: "https://api.anilibria.tv/v3/{{ if .Keywords }}searchTitles{{ else }}getUpdates{{ end }}"
response:
type: json
inputs:
search: "{{ .Keywords }}"
filter: "names,posters.small.url,code,torrents.list,season.year,description"
limit: 100
keywordsfilters:
# strip season and ep
- name: re_replace

View File

@@ -72,8 +72,14 @@ search:
inputs:
# if we have an id based search, add Season and Episode as query in name for UNIT3D < v6. Else pass S/E Params for UNIT3D >= v6
api_token: "{{ .Config.apikey }}"
$raw: "{{ range .Categories }}&categories[]={{.}}{{end}}"
name: "{{ .Keywords }}"
$raw: "{{ if .Query.Season }}&seasonNumber={{ .Query.Season }}{{ else }}{{ end }}{{ if .Query.Ep }}&episodeNumber={{ .Query.Ep }}{{ else }}{{ end }}{{ if .Query.TMDBID }}&tmdbId={{ .Query.TMDBID }}{{ else }}{{ end }}{{ if .Query.IMDBIDShort }}&imdbId={{ .Query.IMDBIDShort }}{{ else }}{{ end }}{{ if .Query.TVDBID }}&tvdbId={{ .Query.TVDBID }}{{ else }}{{ end }}{{ range .Categories }}&categories[]={{.}}{{end}}{{ if .Config.freeleech }}&free[]=100{{ else }}{{ end }}"
seasonNumber: "{{ .Query.Season }}"
episodeNumber: "{{ .Query.Ep }}"
imdbId: "{{ .Query.IMDBIDShort }}"
tmdbId: "{{ .Query.TMDBID }}"
tvdbId: "{{ .Query.TVDBID }}"
"free[]": "{{ if .Config.freeleech }}100{{ else }}{{ end }}"
sortField: "{{ .Config.sort }}"
sortDirection: "{{ .Config.type }}"
perPage: 100

View File

@@ -89,6 +89,7 @@ search:
# http://electro-torrent.pl/szukaj.php?search=&typ=torrent&cat=0
paths:
- path: szukaj.php
allowEmptyInputs: true
inputs:
# does not support multi cat selection, defaulting to all
# $raw: "{{ range .Categories }}c{{.}}=1&{{end}}"

View File

@@ -42,6 +42,7 @@ download:
search:
paths:
- path: /
allowEmptyInputs: true
inputs:
s: "{{ .Keywords }}"

View File

@@ -70,6 +70,8 @@ login:
search:
paths:
- path: torrents.php
allowEmptyInputs: true
inputs:
# currently supports only one query id at one time.
search: "{{ if .Query.IMDBID }}{{ .Query.IMDBID }}{{ else }}{{ end }}{{ if or .Query.IMDBID .Query.DoubanID }} {{ else }}{{ .Keywords }}{{ end }}{{ if .Query.DoubanID }}{{ .Query.DoubanID }}{{ else }}{{ end }}"

View File

@@ -491,6 +491,9 @@
"$ref": "#/definitions/SearchPathBlock"
}
},
"allowEmptyInputs": {
"type": "boolean"
},
"inputs": {
"type": "object",
"additionalProperties": false,

View File

@@ -67,12 +67,13 @@ search:
paths:
- path: browse
inputs:
# free: 0 all, 1 gold, 2 silver, 3 normal
$raw: "{{ range .Categories }}c{{.}}=1&{{end}}{{ if .Config.freeleech }}free=1{{ else }}{{ end }}"
$raw: "{{ range .Categories }}c{{.}}=1&{{end}}"
# replace spaces with wildcard (percent symbol) as site's default search is exact string.
search: "{{ if .Keywords }}{{ re_replace .Keywords \"[\\s]+\" \"%\" }}{{ else }}%{{ end }}"
search: "{{ re_replace .Keywords \"[\\s]+\" \"%\" }}"
# 0 active, 1 incldead, 2 onlydead, 3 noseeders
incldead: 1
# 0 all, 1 gold, 2 silver, 3 normal
free: "{{ if .Config.freeleech }}1{{ else }}{{ end }}"
keywordsfilters:
# remove the year from the titles as the site chokes on them during search https://github.com/Jackett/Jackett/issues/4397#issuecomment-623148789
- name: re_replace

View File

@@ -1400,13 +1400,18 @@ namespace Jackett.Common.Indexers
if (key.Length == 0)
continue;
var value = "";
if (parts.Count() == 2)
if (parts.Length == 2)
value = parts[1];
queryCollection.Add(key, value);
}
}
else
queryCollection.Add(Input.Key, applyGoTemplateText(Input.Value, variables));
{
var inputValue = applyGoTemplateText(Input.Value, variables);
if (!string.IsNullOrWhiteSpace(inputValue) || Search.AllowEmptyInputs)
queryCollection.Add(Input.Key, inputValue);
}
}
}
}

View File

@@ -141,6 +141,7 @@ namespace Jackett.Common.Models
public List<searchPathBlock> Paths { get; set; }
public Dictionary<string, List<string>> Headers { get; set; }
public List<filterBlock> Keywordsfilters { get; set; }
public bool AllowEmptyInputs { get; set; }
public Dictionary<string, string> Inputs { get; set; }
public List<errorBlock> Error { get; set; }
public List<filterBlock> Preprocessingfilters { get; set; }