|
|
@ -50,16 +50,18 @@ class DownloadService : BaseService() { |
|
|
|
val webBook = WebBook(bookSource) |
|
|
|
val webBook = WebBook(bookSource) |
|
|
|
for (index in start..end) { |
|
|
|
for (index in start..end) { |
|
|
|
App.db.bookChapterDao().getChapter(bookUrl, index)?.let { chapter -> |
|
|
|
App.db.bookChapterDao().getChapter(bookUrl, index)?.let { chapter -> |
|
|
|
webBook.getContent(book, chapter, scope = this, context = searchPool) |
|
|
|
if (!BookHelp.hasContent(book, chapter)) { |
|
|
|
.onStart { |
|
|
|
webBook.getContent(book, chapter, scope = this, context = searchPool) |
|
|
|
updateNotification("${chapter.title}开始下载") |
|
|
|
.onStart { |
|
|
|
} |
|
|
|
updateNotification("${chapter.title}开始下载") |
|
|
|
.onSuccess { content -> |
|
|
|
|
|
|
|
content?.let { |
|
|
|
|
|
|
|
BookHelp.saveContent(book, chapter, content) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
updateNotification("${chapter.title}下载完成") |
|
|
|
.onSuccess { content -> |
|
|
|
} |
|
|
|
content?.let { |
|
|
|
|
|
|
|
BookHelp.saveContent(book, chapter, content) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
updateNotification("${chapter.title}下载完成") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|