mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
修复目录无法加载问题 #3149
This commit is contained in:
parent
2e23b4ba78
commit
79218aba28
@ -196,7 +196,8 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
val oldBook = book.copy()
|
val oldBook = book.copy()
|
||||||
WebBook.getChapterList(this, bookSource, book, true)
|
WebBook.getChapterList(this, bookSource, book, true)
|
||||||
.onSuccess(IO) {
|
.onSuccess(IO) {
|
||||||
if (inBookshelf) {
|
val dbBook = appDb.bookDao.getBook(book.name, book.author)
|
||||||
|
if (dbBook?.bookUrl == oldBook.bookUrl) {
|
||||||
if (oldBook.bookUrl == book.bookUrl) {
|
if (oldBook.bookUrl == book.bookUrl) {
|
||||||
appDb.bookDao.update(book)
|
appDb.bookDao.update(book)
|
||||||
} else {
|
} else {
|
||||||
@ -241,10 +242,12 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
) {
|
) {
|
||||||
execute(scope) {
|
execute(scope) {
|
||||||
webFiles.clear()
|
webFiles.clear()
|
||||||
val fileNameExcludeExtension = if (book.author.isBlank()) book.name else "${book.name} 作者:${book.author}"
|
val fileNameNoExtension = if (book.author.isBlank()) book.name
|
||||||
|
else "${book.name} 作者:${book.author}"
|
||||||
book.downloadUrls!!.map {
|
book.downloadUrls!!.map {
|
||||||
val analyzeUrl = AnalyzeUrl(it, source = bookSource)
|
val analyzeUrl = AnalyzeUrl(it, source = bookSource)
|
||||||
val mFileName = UrlUtil.getFileName(analyzeUrl) ?: "${fileNameExcludeExtension}.${analyzeUrl.type}"
|
val mFileName = UrlUtil.getFileName(analyzeUrl)
|
||||||
|
?: "${fileNameNoExtension}.${analyzeUrl.type}"
|
||||||
WebFile(it, mFileName)
|
WebFile(it, mFileName)
|
||||||
}
|
}
|
||||||
}.onError {
|
}.onError {
|
||||||
|
Loading…
Reference in New Issue
Block a user