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