优化下载

pull/1298/head
gedoor 3 years ago
parent 54eeb31767
commit 4089b59e15
  1. 1
      app/src/main/java/io/legado/app/model/CacheBook.kt
  2. 3
      app/src/main/java/io/legado/app/service/CacheBookService.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 {

@ -82,6 +82,9 @@ class CacheBookService : BaseService() {
private fun removeDownload(bookUrl: String?) {
CacheBook.cacheBookMap.remove(bookUrl)
if (CacheBook.cacheBookMap.isEmpty()) {
stopSelf()
}
}
private fun download() {

Loading…
Cancel
Save