Skip to content

Commit

Permalink
cardigann: add pagination
Browse files Browse the repository at this point in the history
Co-Authored-By: ilike2burnthing <[email protected]>
  • Loading branch information
mynameisbogdan and ilike2burnthing committed Mar 5, 2023
1 parent 954e1cd commit fcb7975
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/anilibria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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?search={{ .Keywords }}&{{ else }}getUpdates?{{ end }}filter=names,posters.small.url,code,torrents.list,season.year,description&limit={{ if eq .Query.Limit \"0\" }}100{{ else }}{{ .Query.Limit }}{{ end }}&after={{ .Query.Offset }}"
response:
type: json

Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/animetracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ search:
$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
perPage: "{{ if eq .Query.Limit \"0\" }}100{{ else }}{{ .Query.Limit }}{{ end }}"
page: 1

keywordsfilters:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/anirena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ caps:

search:
paths:
- path: "{{ if .Keywords }}?s={{ .Keywords}}{{ else }}{{ end }}"
- path: "?s={{ .Keywords }}&start={{ .Query.Offset }}"

rows:
selector: table tbody tr:has(td.torrents_small_type_data1)
Expand Down
1 change: 1 addition & 0 deletions src/Jackett.Common/Definitions/bigfangroup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ search:
format: 0
s: "{{ .Config.sort }}"
d: "{{ .Config.type }}"
page: "{{ .Query.CurrentPage0 }}"

rows:
selector: table > tbody#highlighted > tr:has(a[href^="browse.php?cat="])
Expand Down
1 change: 1 addition & 0 deletions src/Jackett.Common/Definitions/bitsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ search:
q: "{{ .Keywords }}"
sort: "{{ .Config.sort }}"
order: "{{ .Config.type }}"
page: "{{ .Query.CurrentPage1 }}"

keywordsfilters:
- name: re_replace
Expand Down
4 changes: 2 additions & 2 deletions src/Jackett.Common/Definitions/digitalcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ search:
extendedDead: true
extendedSearch: false
freeleech: "{{ if .Config.freeleech }}true{{ else }}false{{ end }}"
index: 0
limit: 100
index: "{{ .Query.Offset }}"
limit: "{{ if eq .Query.Limit \"0\" }}100{{ else }}{{ .Query.Limit }}{{ end }}"
order: "{{ .Config.type }}"
page: search
searchText: "{{ if .Query.IMDBID }}{{ .Query.IMDBID }} {{ else }}{{ end }}{{ .Keywords }}"
Expand Down
2 changes: 2 additions & 0 deletions src/Jackett.Common/Indexers/CardigannIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,8 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
variables[".Query.Year"] = query.Year?.ToString() ?? null;
variables[".Query.Limit"] = query.Limit.ToString() ?? null;
variables[".Query.Offset"] = query.Offset.ToString() ?? null;
variables[".Query.CurrentPage0"] = Math.Max(0, query.Offset > 0 && query.Limit > 0 ? query.Offset / query.Limit : 0).ToString();
variables[".Query.CurrentPage1"] = Math.Max(1, query.Offset > 0 && query.Limit > 0 ? (query.Offset / query.Limit) + 1 : 1).ToString();
variables[".Query.Extended"] = query.Extended.ToString();
variables[".Query.Categories"] = query.Categories;
variables[".Query.APIKey"] = query.ApiKey;
Expand Down

0 comments on commit fcb7975

Please sign in to comment.