添加批量换源

pull/1751/head
kunfei 3 years ago
parent c267382d6f
commit 5098a82e4a
  1. 8
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt

@ -47,7 +47,13 @@ class ArrangeBookViewModel(application: Application) : BaseViewModel(application
if (book.isLocalBook()) return@forEachIndexed
if (book.origin == source.bookSourceUrl) return@forEachIndexed
WebBook.preciseSearchAwait(this, book.name, book.author, source)?.let {
book.changeTo(it.second)
val newBook = it.second
book.changeTo(newBook)
if (newBook.tocUrl.isEmpty()) {
WebBook.getBookInfoAwait(this, source, newBook)
}
val toc = WebBook.getChapterListAwait(this, source, newBook)
appDb.bookChapterDao.insert(*toc.toTypedArray())
}
}
}.onFinally {

Loading…
Cancel
Save