优化tts导入

pull/1861/head
kunfei 3 years ago
parent e0b64f8a4a
commit e02e874163
  1. 13
      app/src/main/java/io/legado/app/ui/association/ImportHttpTtsViewModel.kt

@ -6,12 +6,9 @@ import com.jayway.jsonpath.JsonPath
import io.legado.app.R
import io.legado.app.base.BaseViewModel
import io.legado.app.data.appDb
import io.legado.app.data.entities.BookSource
import io.legado.app.data.entities.HttpTTS
import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.ContentProcessor
import io.legado.app.help.SourceHelp
import io.legado.app.help.config.AppConfig
import io.legado.app.help.http.newCallResponseBody
import io.legado.app.help.http.okHttpClient
import io.legado.app.help.http.text
@ -52,9 +49,13 @@ class ImportHttpTtsViewModel(app: Application) : BaseViewModel(app) {
fun importSelect(finally: () -> Unit) {
execute {
val keepName = AppConfig.importKeepName
val selectSource = arrayListOf<BookSource>()
SourceHelp.insertBookSource(*selectSource.toTypedArray())
val selectSource = arrayListOf<HttpTTS>()
selectStatus.forEachIndexed { index, b ->
if (b) {
selectSource.add(allSources[index])
}
}
appDb.httpTTSDao.insert(*selectSource.toTypedArray())
ContentProcessor.upReplaceRules()
}.onFinally {
finally.invoke()

Loading…
Cancel
Save