mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-19 17:49:44 +02:00
use SeekableInMemoryByteChannel
instead of tempFile
This commit is contained in:
@@ -105,7 +105,7 @@ class ChapterLoader(
|
|||||||
is Format.Directory -> DirectoryPageLoader(format.file)
|
is Format.Directory -> DirectoryPageLoader(format.file)
|
||||||
is Format.Zip -> ZipPageLoader(tempFileManager.createTempFile(format.file))
|
is Format.Zip -> ZipPageLoader(tempFileManager.createTempFile(format.file))
|
||||||
is Format.SevenZip -> try {
|
is Format.SevenZip -> try {
|
||||||
SevenZipPageLoader(tempFileManager.createTempFile(format.file)) {
|
SevenZipPageLoader(format.file) {
|
||||||
GlobalScope.launchUI {
|
GlobalScope.launchUI {
|
||||||
context.toast(context.stringResource(MR.strings.loader_7zip_slow_archives, it))
|
context.toast(context.stringResource(MR.strings.loader_7zip_slow_archives, it))
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.loader
|
package eu.kanade.tachiyomi.ui.reader.loader
|
||||||
|
|
||||||
|
import com.hippo.unifile.UniFile
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||||
import eu.kanade.tachiyomi.util.storage.SevenZUtil.getImages
|
import eu.kanade.tachiyomi.util.storage.SevenZUtil.getImages
|
||||||
import org.apache.commons.compress.archivers.sevenz.SevenZFile
|
import org.apache.commons.compress.archivers.sevenz.SevenZFile
|
||||||
import java.io.File
|
import org.apache.commons.compress.utils.SeekableInMemoryByteChannel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader used to load a chapter from a .7z or .cb7 file.
|
* Loader used to load a chapter from a .7z or .cb7 file.
|
||||||
*/
|
*/
|
||||||
internal class SevenZipPageLoader(
|
internal class SevenZipPageLoader(
|
||||||
private val file: File,
|
private val file: UniFile,
|
||||||
private val notifySlowArchive: (method: String) -> Unit,
|
private val notifySlowArchive: (method: String) -> Unit,
|
||||||
) : PageLoader() {
|
) : PageLoader() {
|
||||||
|
|
||||||
private val zip by lazy { SevenZFile(file) }
|
private val zip by lazy { SevenZFile(SeekableInMemoryByteChannel(file.openInputStream().readBytes())) }
|
||||||
|
|
||||||
override var isLocal: Boolean = true
|
override var isLocal: Boolean = true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user