pull/42/head
kunfei 5 years ago
parent 5db61df0b2
commit 715f3ed0e8
  1. 10
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

@ -107,7 +107,7 @@ class HttpReadAloudService : BaseReadAloudService(),
private fun getAudioBody(content: String): Map<String, String> { private fun getAudioBody(content: String): Map<String, String> {
return mapOf( return mapOf(
Pair("tex", URLEncoder.encode(URLEncoder.encode(content, "UTF-8"), "UTF-8")), Pair("tex", encodeTwo(content)),
Pair("spd", ((getPrefInt("ttsSpeechRate", 25) + 5) / 5).toString()), Pair("spd", ((getPrefInt("ttsSpeechRate", 25) + 5) / 5).toString()),
Pair("per", getPrefString("ttsSpeechPer") ?: "0"), Pair("per", getPrefString("ttsSpeechPer") ?: "0"),
Pair("cuid", "baidu_speech_demo"), Pair("cuid", "baidu_speech_demo"),
@ -122,6 +122,14 @@ class HttpReadAloudService : BaseReadAloudService(),
) )
} }
private fun encodeTwo(content: String): String {
return try {
URLEncoder.encode(URLEncoder.encode(content, "UTF-8"), "UTF-8")
} catch (e: Exception) {
""
}
}
override fun pauseReadAloud(pause: Boolean) { override fun pauseReadAloud(pause: Boolean) {
super.pauseReadAloud(pause) super.pauseReadAloud(pause)
mediaPlayer.pause() mediaPlayer.pause()

Loading…
Cancel
Save