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>>() 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()) { 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 {
@ -158,7 +158,8 @@ object BookHelp {
).writeBytes(it) ).writeBytes(it)
} }
} catch (e: Exception) { } catch (e: Exception) {
AppLog.putDebug("${src}下载错误", e) e.printStackTrace()
AppLog.put("${src}下载错误", e)
} finally { } finally {
downloadImages.remove(src) downloadImages.remove(src)
} }

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

@ -505,7 +505,12 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
upAdapterLiveData.postValue(book.bookUrl) upAdapterLiveData.postValue(book.bookUrl)
exportProgress[book.bookUrl] = index exportProgress[book.bookUrl] = index
BookHelp.getContent(book, chapter).let { content -> 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 content1 = contentProcessor
.getContent( .getContent(
book, book,

Loading…
Cancel
Save