Buondua: Upgrade to 1.6 & add preference for options to split pages or combine all pages into 1 gallery#17654
Conversation
…es into 1 gallery
AwkwardPeak7
left a comment
There was a problem hiding this comment.
consider migrating to KeiSource too
| return (1..maxPage).parallelCatchingFlatMap { page -> | ||
| val doc = when (page) { | ||
| 1 -> document | ||
| else -> { | ||
| val pageUrl = basePageUrl.toHttpUrl().newBuilder() | ||
| .setQueryParameter("page", page.toString()) | ||
| .build() | ||
| client.get(pageUrl).asJsoup() | ||
| } | ||
| } | ||
| doc.select(pageListSelector).map { imgEl -> | ||
| imgEl.absUrl("src") | ||
| } | ||
| }.mapIndexed { index, url -> | ||
| Page(index, imageUrl = url) | ||
| } |
There was a problem hiding this comment.
instead of fetching all pages together like this, set Page.url with the html page link and get imgurl in getImageUrl
There was a problem hiding this comment.
Sorry I don't get it. The page(s) which are being fetch in parallel are html page, each of them have a dozen of images (Page) inside.
Original code was put each of page into a chapter, then when chapter is loaded, it will fetch page.
New code is fetching all page(s) to find the list of imgurl and put them all together in 1 merged Gallery.
There was a problem hiding this comment.
Ah yes. In that case, you don't need to silently swallow exceptions and miss pages. Inline the async code without runcatching
Checklist:
versionCodevalue inbuild.gradle.ktsbaseVersionCodeinbuild.gradle.kts(if updated multisrc theme code)contentWarningconfiguration inbuild.gradle.ktsappropriatelyidif a source's name or language were changedweb_hi_res_512.pngwhen adding a new extension