From 4089b59e152b7fc3f81aa6f1b4bcc24fb719d8b5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 6 Sep 2021 14:37:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/CacheBook.kt | 1 + app/src/main/java/io/legado/app/service/CacheBookService.kt | 3 +++ 2 files changed, 4 insertions(+) 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 6613bce69..7b89ebcc7 100644 --- a/app/src/main/java/io/legado/app/model/CacheBook.kt +++ b/app/src/main/java/io/legado/app/model/CacheBook.kt @@ -162,6 +162,7 @@ class CacheBook(val bookSource: BookSource, val book: Book) { }.onError { onDownloadSet.remove(chapterIndex) waitDownloadSet.add(chapterIndex) + print(it.localizedMessage) addLog("${book.name}-${chapter.title} getContentError${it.localizedMessage}") downloadFinish(chapter, it.localizedMessage ?: "download error") }.onCancel { diff --git a/app/src/main/java/io/legado/app/service/CacheBookService.kt b/app/src/main/java/io/legado/app/service/CacheBookService.kt index e5b7beab4..3005a9be9 100644 --- a/app/src/main/java/io/legado/app/service/CacheBookService.kt +++ b/app/src/main/java/io/legado/app/service/CacheBookService.kt @@ -82,6 +82,9 @@ class CacheBookService : BaseService() { private fun removeDownload(bookUrl: String?) { CacheBook.cacheBookMap.remove(bookUrl) + if (CacheBook.cacheBookMap.isEmpty()) { + stopSelf() + } } private fun download() {