Skip to content

Commit

Permalink
fix mangadex cover pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Snd-R committed Sep 8, 2024
1 parent 43b6d1d commit 42f3607
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ class MangaDexMetadataProvider(
private suspend fun getAllCovers(mangaId: MangaDexMangaId): List<MangaDexCoverArt> {
val covers = mutableListOf<MangaDexCoverArt>()
var offset = 0
while (true) {
val page = client.getSeriesCovers(mangaId, 100, 0)
var requestCount = 0
while (requestCount < 100) {
val page = client.getSeriesCovers(mangaId, 100, offset)
covers.addAll(page.data)
if (page.offset + page.limit > page.total) break
offset += page.limit
requestCount++
}
return covers
}
Expand Down

0 comments on commit 42f3607

Please sign in to comment.