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

View File

@ -34,7 +34,6 @@ disklrucache = "com.jakewharton:disklrucache:2.0.2"
unifile = "com.github.tachiyomiorg:unifile:7c257e1c64"
common-compress = "org.apache.commons:commons-compress:1.25.0"
junrar = "com.github.junrar:junrar:7.5.5"
common-compress = "org.apache.commons:commons-compress:1.25.0"
xz = "org.tukaani:xz:1.9"
sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqlite" }