|
|
@ -11,6 +11,7 @@ import io.legado.app.model.webBook.PreciseSearch |
|
|
|
import io.legado.app.model.webBook.WebBook |
|
|
|
import io.legado.app.model.webBook.WebBook |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
|
|
|
|
import kotlinx.coroutines.isActive |
|
|
|
import rxhttp.wrapper.param.RxHttp |
|
|
|
import rxhttp.wrapper.param.RxHttp |
|
|
|
import rxhttp.wrapper.param.toText |
|
|
|
import rxhttp.wrapper.param.toText |
|
|
|
|
|
|
|
|
|
|
@ -105,6 +106,7 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application) |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
val bookSources = App.db.bookSourceDao.allEnabled |
|
|
|
val bookSources = App.db.bookSourceDao.allEnabled |
|
|
|
GSON.fromJsonArray<Map<String, String?>>(json)?.forEach { |
|
|
|
GSON.fromJsonArray<Map<String, String?>>(json)?.forEach { |
|
|
|
|
|
|
|
if (!isActive) return@execute |
|
|
|
val name = it["name"] ?: "" |
|
|
|
val name = it["name"] ?: "" |
|
|
|
val author = it["author"] ?: "" |
|
|
|
val author = it["author"] ?: "" |
|
|
|
if (name.isNotEmpty() && App.db.bookDao.getBook(name, author) == null) { |
|
|
|
if (name.isNotEmpty() && App.db.bookDao.getBook(name, author) == null) { |
|
|
|