mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
文件类书源解压位置改到保存书籍目录的地方
This commit is contained in:
parent
3a739f4e55
commit
128726b0a0
@ -160,6 +160,7 @@ object LocalBook {
|
||||
//updateTime变量不要修改,否则会导致读取不到缓存
|
||||
val (fileName, _, _, updateTime, _) = FileDoc.fromUri(uri, false).apply {
|
||||
if (size == 0L) throw EmptyFileException("Unexpected empty File")
|
||||
|
||||
bookUrl = toString()
|
||||
}
|
||||
var book = appDb.bookDao.getBook(bookUrl)
|
||||
|
@ -12,7 +12,6 @@ import io.legado.app.constant.AppPattern
|
||||
import io.legado.app.constant.BookSourceType
|
||||
import io.legado.app.constant.BookType
|
||||
import io.legado.app.constant.EventBus
|
||||
import io.legado.app.help.config.AppConfig.defaultBookTreeUri
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.Book
|
||||
import io.legado.app.data.entities.BookChapter
|
||||
@ -275,7 +274,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
||||
|
||||
fun deCompress(archiveFileUri: Uri, onSuccess: (List<FileDoc>) -> Unit) {
|
||||
execute {
|
||||
ArchiveUtils.deCompress(archiveFileUri, defaultBookTreeUri!!).list {
|
||||
ArchiveUtils.deCompress(archiveFileUri).list {
|
||||
AppPattern.bookFileRegex.matches(it.name)
|
||||
} ?: emptyList()
|
||||
}.onError {
|
||||
@ -286,7 +285,11 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
||||
}
|
||||
|
||||
fun importBook(fileDoc: FileDoc) {
|
||||
LocalBook.importFile(fileDoc.uri).let { changeToLocalBook(it) }
|
||||
val uri = LocalBook.saveBookFile(
|
||||
fileDoc.uri.inputstream(context),
|
||||
fileDoc.name
|
||||
)
|
||||
LocalBook.importFile(uri).let { changeToLocalBook(it) }
|
||||
}
|
||||
|
||||
fun changeTo(source: BookSource, book: Book, toc: List<BookChapter>) {
|
||||
|
Loading…
Reference in New Issue
Block a user