commit
eae5ae2244
@ -0,0 +1,15 @@ |
||||
# 在线朗读规则说明 |
||||
|
||||
* 在线朗读规则为url规则,同书源url |
||||
* js参数 |
||||
~~~ |
||||
speakText //朗读文本 |
||||
speakSpeed //朗读速度,0-45 |
||||
~~~ |
||||
* 例: |
||||
~~~ |
||||
http://tts.baidu.com/text2audio,{ |
||||
"method": "POST", |
||||
"body": "tex={{java.encodeURI(java.encodeURI(speakText))}}&spd={{String((speakSpeed + 5) / 10 + 4)}}&per=5003&cuid=baidu_speech_demo&idx=1&cod=2&lan=zh&ctp=1&pdt=1&vol=5&pit=5&_res_tag_=audio" |
||||
} |
||||
~~~ |
@ -0,0 +1,47 @@ |
||||
package io.legado.app.help |
||||
|
||||
import io.legado.app.App |
||||
import io.legado.app.data.entities.HttpTTS |
||||
import io.legado.app.data.entities.TxtTocRule |
||||
import io.legado.app.utils.GSON |
||||
import io.legado.app.utils.fromJsonArray |
||||
import java.io.File |
||||
|
||||
object DefaultData { |
||||
|
||||
const val httpTtsFileName = "httpTTS.json" |
||||
const val txtTocRuleFileName = "txtTocRule.json" |
||||
|
||||
val defaultHttpTTS by lazy { |
||||
val json = |
||||
String( |
||||
App.INSTANCE.assets.open("defaultData${File.separator}$httpTtsFileName") |
||||
.readBytes() |
||||
) |
||||
GSON.fromJsonArray<HttpTTS>(json)!! |
||||
} |
||||
|
||||
val defaultReadConfigs by lazy { |
||||
val json = String( |
||||
App.INSTANCE.assets.open("defaultData${File.separator}${ReadBookConfig.configFileName}") |
||||
.readBytes() |
||||
) |
||||
GSON.fromJsonArray<ReadBookConfig.Config>(json)!! |
||||
} |
||||
|
||||
val defaultTxtTocRules by lazy { |
||||
val json = String( |
||||
App.INSTANCE.assets.open("defaultData${File.separator}$txtTocRuleFileName") |
||||
.readBytes() |
||||
) |
||||
GSON.fromJsonArray<TxtTocRule>(json)!! |
||||
} |
||||
|
||||
val defaultThemeConfigs by lazy { |
||||
val json = String( |
||||
App.INSTANCE.assets.open("defaultData${File.separator}${ThemeConfig.configFileName}") |
||||
.readBytes() |
||||
) |
||||
GSON.fromJsonArray<ThemeConfig.Config>(json)!! |
||||
} |
||||
} |
@ -1,19 +0,0 @@ |
||||
package io.legado.app.help |
||||
|
||||
import io.legado.app.App |
||||
import io.legado.app.data.entities.HttpTTS |
||||
import io.legado.app.utils.GSON |
||||
import io.legado.app.utils.fromJsonArray |
||||
|
||||
object DefaultValueHelp { |
||||
|
||||
|
||||
fun initHttpTTS() { |
||||
val json = String(App.INSTANCE.assets.open("httpTTS.json").readBytes()) |
||||
GSON.fromJsonArray<HttpTTS>(json)?.let { |
||||
App.db.httpTTSDao().insert(*it.toTypedArray()) |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue