pull/2724/head
Horis 2 years ago
parent 2e937f8dd6
commit 9c96fcb1d4
  1. 5
      app/src/main/java/io/legado/app/help/book/BookHelp.kt
  2. 6
      app/src/main/java/io/legado/app/model/CacheBook.kt
  3. 7
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt

@ -120,7 +120,7 @@ object BookHelp {
val awaitList = arrayListOf<Deferred<Unit>>()
content.split("\n").forEach {
val matcher = AppPattern.imgPattern.matcher(it)
if (matcher.find()) {
while (matcher.find()) {
matcher.group(1)?.let { src ->
val mSrc = NetworkUtils.getAbsoluteURL(bookChapter.url, src)
awaitList.add(async {
@ -158,7 +158,8 @@ object BookHelp {
).writeBytes(it)
}
} catch (e: Exception) {
AppLog.putDebug("${src}下载错误", e)
e.printStackTrace()
AppLog.put("${src}下载错误", e)
} finally {
downloadImages.remove(src)
}

@ -248,6 +248,12 @@ object CacheBook {
waitDownloadSet.remove(chapterIndex)
return
}
if (chapter.isVolume) {
/** 修正下载计数 */
postEvent(EventBus.SAVE_CONTENT, Pair(book, chapter))
waitDownloadSet.remove(chapterIndex)
return
}
if (BookHelp.hasImageContent(book, chapter)) {
waitDownloadSet.remove(chapterIndex)
return

@ -505,7 +505,12 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
upAdapterLiveData.postValue(book.bookUrl)
exportProgress[book.bookUrl] = index
BookHelp.getContent(book, chapter).let { content ->
var content1 = fixPic(epubBook, book, content ?: "null", chapter)
var content1 = fixPic(
epubBook,
book,
content ?: if (chapter.isVolume) "" else "null",
chapter
)
content1 = contentProcessor
.getContent(
book,

Loading…
Cancel
Save