This commit is contained in:
AbdallahMehiz
2024-02-03 22:23:23 +01:00
parent f6ae7ce24e
commit fa550e465b
3 changed files with 4 additions and 6 deletions

View File

@@ -104,8 +104,7 @@ class ChapterLoader(
is Format.Directory -> DirectoryPageLoader(format.file)
is Format.Zip -> ZipPageLoader(format.file.openReadOnlyChannel(context))
is Format.SevenZip -> try {
val file = context.contentResolver.openFileDescriptor(format.file.uri, "r")
SevenZipPageLoader(AutoCloseInputStream(file)) {
SevenZipPageLoader(format.file.openReadOnlyChannel(context)) {
GlobalScope.launchUI {
context.toast(context.stringResource(MR.strings.loader_7zip_slow_archives, it))
}

View File

@@ -4,17 +4,17 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.util.storage.SevenZUtil.getImages
import org.apache.commons.compress.archivers.sevenz.SevenZFile
import java.io.FileInputStream
import java.nio.channels.FileChannel
/**
* Loader used to load a chapter from a .7z or .cb7 file.
*/
internal class SevenZipPageLoader(
private val file: FileInputStream,
private val file: FileChannel,
private val notifySlowArchive: (method: String) -> Unit,
) : PageLoader() {
private val zip by lazy { SevenZFile(file.channel) }
private val zip by lazy { SevenZFile(file) }
override var isLocal: Boolean = true