From 9c96fcb1d416024eecb12fac456dcfa87b2997b7 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Wed, 25 Jan 2023 11:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/book/BookHelp.kt | 5 +++-- app/src/main/java/io/legado/app/model/CacheBook.kt | 6 ++++++ .../java/io/legado/app/ui/book/cache/CacheViewModel.kt | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/book/BookHelp.kt b/app/src/main/java/io/legado/app/help/book/BookHelp.kt index 388f16829..a4e2c4c80 100644 --- a/app/src/main/java/io/legado/app/help/book/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/book/BookHelp.kt @@ -120,7 +120,7 @@ object BookHelp { val awaitList = arrayListOf>() 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) } diff --git a/app/src/main/java/io/legado/app/model/CacheBook.kt b/app/src/main/java/io/legado/app/model/CacheBook.kt index e4a864d56..3e1f89200 100644 --- a/app/src/main/java/io/legado/app/model/CacheBook.kt +++ b/app/src/main/java/io/legado/app/model/CacheBook.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index b74d44465..56601cc30 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -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,