cardigann: check for page size

This commit is contained in:
Bogdan 2023-05-01 21:10:16 +03:00
parent f59cc953ec
commit dc3e068066
4 changed files with 20 additions and 3 deletions

View File

@ -43,6 +43,8 @@ legacylinks:
- https://1337x.unblockit.click/ - https://1337x.unblockit.click/
caps: caps:
limitsDefault: 80
limitsMax: 80
categorymappings: categorymappings:
# Anime # Anime
- {id: 28, cat: TV/Anime, desc: "Anime/Anime"} - {id: 28, cat: TV/Anime, desc: "Anime/Anime"}
@ -181,6 +183,9 @@ download:
attribute: href attribute: href
search: search:
pageSize: 20
pageable: "{{ if or .Query.Album .Query.Artist .Keywords }}true{{ else }}false{{ end }}"
paths: paths:
# present first page of movies tv and music results if there are no search parms supplied (20 hits per page) # present first page of movies tv and music results if there are no search parms supplied (20 hits per page)
- path: "{{ if or .Query.Album .Query.Artist .Keywords }}sort-search{{ else }}cat/Movies{{ end }}{{ if or .Query.Album .Query.Artist }}/{{ or .Query.Album .Query.Artist }}{{ else }}/{{ .Keywords }}{{ end }}{{ if or .Query.Album .Query.Artist .Keywords }}/{{ else }}{{ end }}{{ .Config.sort }}/{{ .Config.type }}/1/" - path: "{{ if or .Query.Album .Query.Artist .Keywords }}sort-search{{ else }}cat/Movies{{ end }}{{ if or .Query.Album .Query.Artist }}/{{ or .Query.Album .Query.Artist }}{{ else }}/{{ .Keywords }}{{ end }}{{ if or .Query.Album .Query.Artist .Keywords }}/{{ else }}{{ end }}{{ .Config.sort }}/{{ .Config.type }}/1/"

View File

@ -495,7 +495,14 @@
"minimum": 1 "minimum": 1
}, },
"pageable": { "pageable": {
"type": "boolean" "oneOf": [
{
"type": "boolean"
},
{
"type": "string"
}
]
}, },
"path": { "path": {
"type": "string" "type": "string"

View File

@ -1359,6 +1359,11 @@ namespace Jackett.Common.Indexers
var pageSize = PageSize; var pageSize = PageSize;
if (!bool.TryParse(applyGoTemplateText(Search.Pageable, variables), out var pageable))
{
pageable = false;
}
// TODO: prepare queries first and then send them parallel // TODO: prepare queries first and then send them parallel
var SearchPaths = Search.Paths; var SearchPaths = Search.Paths;
foreach (var SearchPath in SearchPaths) foreach (var SearchPath in SearchPaths)
@ -1743,7 +1748,7 @@ namespace Jackett.Common.Indexers
pageSize = pageSize == 1 ? releases.Count : pageSize; pageSize = pageSize == 1 ? releases.Count : pageSize;
if (Search.Pageable && !IsFullPage(releases, pageSize)) if (pageable && !IsFullPage(releases, pageSize))
{ {
break; break;
} }

View File

@ -140,7 +140,7 @@ namespace Jackett.Common.Models
public class searchBlock public class searchBlock
{ {
public int PageSize { get; set; } public int PageSize { get; set; }
public bool Pageable { get; set; } public string Pageable { get; set; }
public string Path { get; set; } public string Path { get; set; }
public List<searchPathBlock> Paths { get; set; } public List<searchPathBlock> Paths { get; set; }
public Dictionary<string, List<string>> Headers { get; set; } public Dictionary<string, List<string>> Headers { get; set; }