From f906380c8eab26cbdd5bc57462a0bc835dbfd426 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 23 Jan 2022 22:14:51 +0800 Subject: [PATCH] =?UTF-8?q?http=E6=9C=97=E8=AF=BB=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E9=94=99=E8=AF=AF5=E6=AC=A1=E5=90=8E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/service/HttpReadAloudService.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index b14f43d98..79f073b3b 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -180,22 +180,26 @@ class HttpReadAloudService : BaseReadAloudService(), is SocketTimeoutException, is ConnectException -> { removeSpeakCache(fileName) downloadErrorNo++ - if (playErrorNo > 5) { - downloadErrorNo = 0 - createSilentSound(fileName) + if (downloadErrorNo > 5) { val msg = "tts超时或连接错误超过5次\n${it.localizedMessage}" AppLog.put(msg, it) toastOnUi(msg) + pauseReadAloud(true) } else { downloadAudio() } } else -> { removeSpeakCache(fileName) - createSilentSound(fileName) + downloadErrorNo++ val msg = "tts下载错误\n${it.localizedMessage}" AppLog.put(msg, it) Timber.e(it) + if (downloadErrorNo > 5) { + pauseReadAloud(true) + } else { + createSilentSound(fileName) + } } } }