From fd6b1f448492644945da8f28ce0859b7790ec71f Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sat, 12 Feb 2022 16:47:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=89=8D=E5=85=88=E6=8A=8A?= =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E6=A0=A1=E9=AA=8C=E7=9A=84=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E5=88=86=E7=BB=84=E5=8E=BB=E6=8E=89=EF=BC=8C=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E5=B9=B2=E6=89=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/data/entities/BookSource.kt | 7 +++++-- .../main/java/io/legado/app/service/CheckSourceService.kt | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index b75aceeb7..c22d5a345 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -142,11 +142,14 @@ data class BookSource( return false } + fun removeInvalidGroups() { + removeGroup(getInvalidGroupNames()) + } - fun getInvalidGroupNames(): String? { + fun getInvalidGroupNames(): String { return bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.filter { "失效" in it - }?.joinToString() + }?.joinToString() ?: "" } fun equal(source: BookSource) = 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 68ca8c211..e865b9f00 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -124,6 +124,7 @@ class CheckSourceService : BaseService() { searchWord = it } } + source.removeInvalidGroups() source.bookSourceComment = source.bookSourceComment ?.split("\n\n") ?.filterNot { @@ -172,7 +173,7 @@ class CheckSourceService : BaseService() { } } val finalCheckMessage = source.getInvalidGroupNames() - if (!finalCheckMessage.isNullOrBlank()) throw NoStackTraceException(finalCheckMessage) + if (finalCheckMessage.isNotBlank()) throw NoStackTraceException(finalCheckMessage) }.timeout(CheckSource.timeout) .onError(searchCoroutine) { when(it) { @@ -230,7 +231,7 @@ class CheckSourceService : BaseService() { when (it) { is ContentEmptyException -> source.addGroup("${bookType}正文失效") is TocEmptyException -> source.addGroup("${bookType}目录失效") - //超时??js错误 + //超时 网站异常 源码改变 else -> throw it } }.onSuccess {