Merge pull request #1604 from Xwite/master

fix:不能识别规则失效导致的校验失败
pull/1606/head
kunfei 3 years ago committed by GitHub
commit dd5f5a1abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/src/main/assets/help/SourceMBookHelp.md
  2. 1
      app/src/main/assets/updateLog.md
  3. 7
      app/src/main/java/io/legado/app/service/CheckSourceService.kt

@ -22,4 +22,8 @@
* 置底所选 * 置底所选
* 导出所选 * 导出所选
* 校验所选 * 校验所选
* "校验成功"是指所选的校验项目全部通过,"失败:发现为空"不视为"失效",校验结束后会自动筛选"失效"书源 * 校验书源可批量校验书源,由于网络等原因结果仅限参考
* "校验成功"是指所选的校验项目全部通过
* 可正常识别搜索为空、发现为空、目录为空、正文为空、校验超时导致的失效,其余原因导致的视为规则失效
* 校验搜索优先使用书源填写的校验关键词,不存在时使用用户输入的关键词
* 校验结束后会自动筛选"失效"书源

@ -15,6 +15,7 @@
* 可以单独给书籍设置朗读tts * 可以单独给书籍设置朗读tts
* 目录界面菜单添加替换开关,开启替换加载时间会长一些 * 目录界面菜单添加替换开关,开启替换加载时间会长一些
* 书源校验添加规则失效分组,更新书源界面帮助文档
**2022/02/09** **2022/02/09**

@ -20,6 +20,7 @@ import io.legado.app.utils.postEvent
import io.legado.app.utils.servicePendingIntent import io.legado.app.utils.servicePendingIntent
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import java.util.concurrent.Executors import java.util.concurrent.Executors
import kotlin.math.min import kotlin.math.min
@ -199,6 +200,10 @@ class CheckSourceService : BaseService() {
when(it) { when(it) {
is ContentEmptyException -> source.addGroup("正文失效") is ContentEmptyException -> source.addGroup("正文失效")
is TocEmptyException -> source.addGroup("目录失效") is TocEmptyException -> source.addGroup("目录失效")
//校验超时不能正常实现 不能识别
is TimeoutCancellationException -> source.addGroup("校验超时")
//NoStackTraceException 已经添加了分组,其余的视为规则失效
!is NoStackTraceException -> source.addGroup("规则失效")
} }
source.bookSourceComment = source.bookSourceComment =
"Error: ${it.localizedMessage}" + if (source.bookSourceComment.isNullOrBlank()) "Error: ${it.localizedMessage}" + if (source.bookSourceComment.isNullOrBlank())
@ -206,6 +211,8 @@ class CheckSourceService : BaseService() {
Debug.updateFinalMessage(source.bookSourceUrl, "校验失败:${it.localizedMessage}") Debug.updateFinalMessage(source.bookSourceUrl, "校验失败:${it.localizedMessage}")
}.onSuccess(searchCoroutine) { }.onSuccess(searchCoroutine) {
source.removeGroup("失效") source.removeGroup("失效")
source.removeGroup("规则失效")
source.removeGroup("校验超时")
Debug.updateFinalMessage(source.bookSourceUrl, "校验成功") Debug.updateFinalMessage(source.bookSourceUrl, "校验成功")
}.onFinally(IO) { }.onFinally(IO) {
source.respondTime = Debug.getRespondTime(source.bookSourceUrl) source.respondTime = Debug.getRespondTime(source.bookSourceUrl)

Loading…
Cancel
Save