From a45edd931a420c0ca47163c80189d3533cb0a450 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 4 Feb 2022 22:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E6=BA=90=E6=A0=A1=E9=AA=8C=EF=BC=9A?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8C=E6=97=B6=E6=A0=A1=E9=AA=8C=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8F=91=E7=8E=B0=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/service/CheckSourceService.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index 45ddc5933..462e6c23b 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -123,14 +123,15 @@ class CheckSourceService : BaseService() { } //校验搜索 用户设置校验搜索 并且 搜索链接不为空 if (CheckSource.checkSearch && !source.searchUrl.isNullOrBlank()) { - books = WebBook.searchBookAwait(this, source, searchWord) - if (books.isEmpty()) { + val searchBooks = WebBook.searchBookAwait(this, source, searchWord) + if (searchBooks.isEmpty()) { source.addGroup("搜索失效") if (!CheckSource.checkDiscovery) { throw NoStackTraceException("搜索书籍为空") } } else { source.removeGroup("搜索失效") + books = searchBooks } } //校验发现 @@ -149,12 +150,16 @@ class CheckSourceService : BaseService() { source.hasGroup("搜索失效") -> throw NoStackTraceException("搜索内容为空并且没有发现") } } else { - books = WebBook.exploreBookAwait(this, source, url) - if (books.isEmpty()) { + val exploreBooks = WebBook.exploreBookAwait(this, source, url) + if (exploreBooks.isEmpty()) { + source.addGroup("发现失效") when { !CheckSource.checkSearch -> throw NoStackTraceException("发现书籍为空") source.hasGroup("搜索失效") -> throw NoStackTraceException("搜索内容和发现书籍为空") } + } else { + source.removeGroup("发现失效") + books = exploreBooks } } } @@ -199,7 +204,7 @@ class CheckSourceService : BaseService() { ?.filterNot { it.startsWith("Error: ") }?.joinToString("\n") - if (source.hasGroup("搜索失效")) { + if (source.hasGroup("搜索失效") || source.hasGroup("发现失效")) { Debug.updateFinalMessage(source.bookSourceUrl, "失败") } else { Debug.updateFinalMessage(source.bookSourceUrl, "成功")