pull/2146/head
821938089 2 years ago
parent ca481c6987
commit d2385c38ea
  1. 6
      app/src/main/java/io/legado/app/help/BookHelp.kt

@ -98,17 +98,15 @@ object BookHelp {
book: Book, book: Book,
bookChapter: BookChapter, bookChapter: BookChapter,
content: String content: String
) { ) = coroutineScope {
val awaitList = arrayListOf<Deferred<Unit>>() val awaitList = arrayListOf<Deferred<Unit>>()
content.split("\n").forEach { content.split("\n").forEach {
val matcher = AppPattern.imgPattern.matcher(it) val matcher = AppPattern.imgPattern.matcher(it)
if (matcher.find()) { if (matcher.find()) {
matcher.group(1)?.let { src -> matcher.group(1)?.let { src ->
val mSrc = NetworkUtils.getAbsoluteURL(bookChapter.url, src) val mSrc = NetworkUtils.getAbsoluteURL(bookChapter.url, src)
awaitList.add(coroutineScope { awaitList.add(async {
async {
saveImage(bookSource, book, mSrc) saveImage(bookSource, book, mSrc)
}
}) })
} }
} }

Loading…
Cancel
Save