mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
cardigann: support range statement with indexing. resolves #13280
This commit is contained in:
@@ -84,7 +84,7 @@ search:
|
|||||||
# 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
|
# 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 }}"
|
api_token: "{{ .Config.apikey }}"
|
||||||
name: "{{ .Keywords }}"
|
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=1{{ else }}{{ end }}"
|
$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=1{{ else }}{{ end }}"
|
||||||
sortField: "{{ .Config.sort }}"
|
sortField: "{{ .Config.sort }}"
|
||||||
sortDirection: "{{ .Config.type }}"
|
sortDirection: "{{ .Config.type }}"
|
||||||
perPage: 100
|
perPage: 100
|
||||||
|
@@ -468,12 +468,21 @@ namespace Jackett.Common.Indexers
|
|||||||
var variable = RangeRegexMatches.Groups[1].Value;
|
var variable = RangeRegexMatches.Groups[1].Value;
|
||||||
var prefix = RangeRegexMatches.Groups[2].Value;
|
var prefix = RangeRegexMatches.Groups[2].Value;
|
||||||
var postfix = RangeRegexMatches.Groups[3].Value;
|
var postfix = RangeRegexMatches.Groups[3].Value;
|
||||||
|
var hasArrayIndex = prefix.Contains("[*]");
|
||||||
|
var arrayIndex = -1;
|
||||||
|
if (hasArrayIndex)
|
||||||
|
prefix = prefix.Replace("[*]", "[-1]");
|
||||||
|
|
||||||
foreach (var value in (ICollection<string>)variables[variable])
|
foreach (var value in (ICollection<string>)variables[variable])
|
||||||
{
|
{
|
||||||
var newvalue = value;
|
var newvalue = value;
|
||||||
if (modifier != null)
|
if (modifier != null)
|
||||||
newvalue = modifier(newvalue);
|
newvalue = modifier(newvalue);
|
||||||
|
if (hasArrayIndex)
|
||||||
|
{
|
||||||
|
prefix = prefix.Replace("[" + arrayIndex.ToString() + "]", "[" + (arrayIndex + 1).ToString() + "]");
|
||||||
|
arrayIndex++;
|
||||||
|
}
|
||||||
expanded += prefix + newvalue + postfix;
|
expanded += prefix + newvalue + postfix;
|
||||||
}
|
}
|
||||||
template = template.Replace(all, expanded);
|
template = template.Replace(all, expanded);
|
||||||
|
Reference in New Issue
Block a user