Skip to content

Commit

Permalink
cardigann: check for page size
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed May 17, 2023
1 parent f59cc95 commit dc3e068
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Jackett.Common/Definitions/1337x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ legacylinks:
- https://1337x.unblockit.click/

caps:
limitsDefault: 80
limitsMax: 80
categorymappings:
# Anime
- {id: 28, cat: TV/Anime, desc: "Anime/Anime"}
Expand Down Expand Up @@ -181,6 +183,9 @@ download:
attribute: href

search:
pageSize: 20
pageable: "{{ if or .Query.Album .Query.Artist .Keywords }}true{{ else }}false{{ end }}"

paths:
# 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/"
Expand Down
9 changes: 8 additions & 1 deletion src/Jackett.Common/Definitions/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,14 @@
"minimum": 1
},
"pageable": {
"type": "boolean"
"oneOf": [
{
"type": "boolean"
},
{
"type": "string"
}
]
},
"path": {
"type": "string"
Expand Down
7 changes: 6 additions & 1 deletion src/Jackett.Common/Indexers/CardigannIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,11 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer

var pageSize = PageSize;

if (!bool.TryParse(applyGoTemplateText(Search.Pageable, variables), out var pageable))
{
pageable = false;
}

// TODO: prepare queries first and then send them parallel
var SearchPaths = Search.Paths;
foreach (var SearchPath in SearchPaths)
Expand Down Expand Up @@ -1743,7 +1748,7 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer

pageSize = pageSize == 1 ? releases.Count : pageSize;

if (Search.Pageable && !IsFullPage(releases, pageSize))
if (pageable && !IsFullPage(releases, pageSize))
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Models/IndexerDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public class ratioBlock : selectorBlock
public class searchBlock
{
public int PageSize { get; set; }
public bool Pageable { get; set; }
public string Pageable { get; set; }
public string Path { get; set; }
public List<searchPathBlock> Paths { get; set; }
public Dictionary<string, List<string>> Headers { get; set; }
Expand Down

0 comments on commit dc3e068

Please sign in to comment.