|
|
@ -118,15 +118,13 @@ object BookHelp { |
|
|
|
content: String |
|
|
|
content: String |
|
|
|
) = coroutineScope { |
|
|
|
) = coroutineScope { |
|
|
|
val awaitList = arrayListOf<Deferred<Unit>>() |
|
|
|
val awaitList = arrayListOf<Deferred<Unit>>() |
|
|
|
content.split("\n").forEach { |
|
|
|
val matcher = AppPattern.imgPattern.matcher(content) |
|
|
|
val matcher = AppPattern.imgPattern.matcher(it) |
|
|
|
while (matcher.find()) { |
|
|
|
while (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(async { |
|
|
|
awaitList.add(async { |
|
|
|
saveImage(bookSource, book, mSrc) |
|
|
|
saveImage(bookSource, book, mSrc) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
awaitList.forEach { |
|
|
|
awaitList.forEach { |
|
|
|