校验和调试时不保存正文

pull/1500/head
gedoor 3 years ago
parent 225b3c435b
commit 2ad300c5cf
  1. 4
      app/src/main/java/io/legado/app/model/Debug.kt
  2. 3
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt
  3. 3
      app/src/main/java/io/legado/app/service/CheckSourceService.kt

@ -253,8 +253,8 @@ object Debug {
.onSuccess { .onSuccess {
log(debugSource, "︽目录页解析完成") log(debugSource, "︽目录页解析完成")
log(debugSource, showTime = false) log(debugSource, showTime = false)
val nextChapterUrl = it.getOrNull(1)?.url val nextChapterUrl = it.getOrNull(1)?.url ?: it.first().url
contentDebug(scope, bookSource, book, it[0], nextChapterUrl) contentDebug(scope, bookSource, book, it.first(), nextChapterUrl)
} }
.onError { .onError {
log(debugSource, it.msg, state = -1) log(debugSource, it.msg, state = -1)

@ -35,7 +35,7 @@ object BookContent {
redirectUrl: String, redirectUrl: String,
baseUrl: String, baseUrl: String,
body: String?, body: String?,
nextChapterUrl: String? = null, nextChapterUrl: String?,
needSave: Boolean = true needSave: Boolean = true
): String { ): String {
body ?: throw NoStackTraceException( body ?: throw NoStackTraceException(
@ -47,6 +47,7 @@ object BookContent {
nextChapterUrl nextChapterUrl
} else { } else {
appDb.bookChapterDao.getChapter(book.bookUrl, bookChapter.index + 1)?.url appDb.bookChapterDao.getChapter(book.bookUrl, bookChapter.index + 1)?.url
?: appDb.bookChapterDao.getChapter(book.bookUrl, 0)?.url
} }
val content = StringBuilder() val content = StringBuilder()
val nextUrlList = arrayListOf(baseUrl) val nextUrlList = arrayListOf(baseUrl)

@ -135,12 +135,13 @@ class CheckSourceService : BaseService() {
} }
val book = WebBook.getBookInfoAwait(this, source, books.first().toBook()) val book = WebBook.getBookInfoAwait(this, source, books.first().toBook())
val toc = WebBook.getChapterListAwait(this, source, book) val toc = WebBook.getChapterListAwait(this, source, book)
val nextChapterUrl = toc.getOrNull(1)?.url ?: toc.first().url
val content = WebBook.getContentAwait( val content = WebBook.getContentAwait(
this, this,
bookSource = source, bookSource = source,
book = book, book = book,
bookChapter = toc.first(), bookChapter = toc.first(),
nextChapterUrl = toc.getOrNull(1)?.url, nextChapterUrl = nextChapterUrl,
needSave = false needSave = false
) )
if (content.isBlank()) { if (content.isBlank()) {

Loading…
Cancel
Save