每次校验失效都应该更新源注释

pull/1591/head
Xwite 3 years ago
parent dd978469f1
commit 774cedb796
  1. 16
      app/src/main/java/io/legado/app/service/CheckSourceService.kt

@ -123,6 +123,11 @@ class CheckSourceService : BaseService() {
searchWord = it searchWord = it
} }
} }
source.bookSourceComment = source.bookSourceComment
?.split("\n\n")
?.filterNot {
it.startsWith("Error: ")
}?.joinToString("\n")
//校验搜索 用户设置校验搜索 并且 搜索链接不为空 //校验搜索 用户设置校验搜索 并且 搜索链接不为空
if (CheckSource.checkSearch && !source.searchUrl.isNullOrBlank()) { if (CheckSource.checkSearch && !source.searchUrl.isNullOrBlank()) {
val searchBooks = WebBook.searchBookAwait(this, source, searchWord) val searchBooks = WebBook.searchBookAwait(this, source, searchWord)
@ -198,17 +203,10 @@ class CheckSourceService : BaseService() {
is ContentEmptyException -> source.addGroup("正文失效") is ContentEmptyException -> source.addGroup("正文失效")
is TocEmptyException -> source.addGroup("目录失效") is TocEmptyException -> source.addGroup("目录失效")
} }
if (source.bookSourceComment?.contains("Error: ") == false) { source.bookSourceComment =
source.bookSourceComment = "Error: ${it.localizedMessage} \n\n" + "${source.bookSourceComment}"
"Error: ${it.localizedMessage} \n\n" + "${source.bookSourceComment}"
}
Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}") Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}")
}.onSuccess(searchCoroutine) { }.onSuccess(searchCoroutine) {
source.bookSourceComment = source.bookSourceComment
?.split("\n\n")
?.filterNot {
it.startsWith("Error: ")
}?.joinToString("\n")
Debug.updateFinalMessage(source.bookSourceUrl, "校验成功") Debug.updateFinalMessage(source.bookSourceUrl, "校验成功")
}.onFinally(searchCoroutine) { }.onFinally(searchCoroutine) {
source.respondTime = Debug.getRespondTime(source.bookSourceUrl) source.respondTime = Debug.getRespondTime(source.bookSourceUrl)

Loading…
Cancel
Save