http朗读下载连续错误5次后自动停止

pull/1560/head^2
gedoor 3 years ago
parent f03ed16cbe
commit f906380c8e
  1. 12
      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)
}
}
}
}

Loading…
Cancel
Save