mirror of https://github.com/Jackett/Jackett
cardigann: support range statement with indexing. resolves #13280
This commit is contained in:
parent
a973ee643a
commit
f561787369
|
@ -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
|
||||
api_token: "{{ .Config.apikey }}"
|
||||
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 }}"
|
||||
sortDirection: "{{ .Config.type }}"
|
||||
perPage: 100
|
||||
|
|
|
@ -468,12 +468,21 @@ namespace Jackett.Common.Indexers
|
|||
var variable = RangeRegexMatches.Groups[1].Value;
|
||||
var prefix = RangeRegexMatches.Groups[2].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])
|
||||
{
|
||||
var newvalue = value;
|
||||
if (modifier != null)
|
||||
newvalue = modifier(newvalue);
|
||||
if (hasArrayIndex)
|
||||
{
|
||||
prefix = prefix.Replace("[" + arrayIndex.ToString() + "]", "[" + (arrayIndex + 1).ToString() + "]");
|
||||
arrayIndex++;
|
||||
}
|
||||
expanded += prefix + newvalue + postfix;
|
||||
}
|
||||
template = template.Replace(all, expanded);
|
||||
|
|
Loading…
Reference in New Issue