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() {