|
|
@ -11,6 +11,7 @@ import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.help.AppWebDav |
|
|
|
import io.legado.app.help.AppWebDav |
|
|
|
|
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.DefaultData |
|
|
|
import io.legado.app.help.DefaultData |
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
import io.legado.app.help.config.LocalConfig |
|
|
|
import io.legado.app.help.config.LocalConfig |
|
|
@ -116,6 +117,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
waitUpTocBooks.remove(bookUrl) |
|
|
|
waitUpTocBooks.remove(bookUrl) |
|
|
|
upTocAdd(bookUrl) |
|
|
|
upTocAdd(bookUrl) |
|
|
|
execute(context = upTocPool) { |
|
|
|
execute(context = upTocPool) { |
|
|
|
|
|
|
|
val oldBook = book.copy() |
|
|
|
val preUpdateJs = source.ruleToc?.preUpdateJs |
|
|
|
val preUpdateJs = source.ruleToc?.preUpdateJs |
|
|
|
if (!preUpdateJs.isNullOrBlank()) { |
|
|
|
if (!preUpdateJs.isNullOrBlank()) { |
|
|
|
AnalyzeRule(book, source).evalJS(preUpdateJs) |
|
|
|
AnalyzeRule(book, source).evalJS(preUpdateJs) |
|
|
@ -129,8 +131,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
upTocAdd(book.bookUrl) |
|
|
|
upTocAdd(book.bookUrl) |
|
|
|
appDb.bookDao.insert(book) |
|
|
|
appDb.bookDao.insert(book) |
|
|
|
|
|
|
|
BookHelp.updateCacheFolder(oldBook, book) |
|
|
|
} |
|
|
|
} |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.delByBook(bookUrl) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
addDownload(source, book) |
|
|
|
addDownload(source, book) |
|
|
|
}.onError(upTocPool) { |
|
|
|
}.onError(upTocPool) { |
|
|
|