fix(local/7z): Fix loading previous pages (#2)

This commit is contained in:
Claudemirovsky
2024-01-03 20:26:31 -03:00
committed by GitHub
parent 9e8b14d141
commit 329bf1039d
3 changed files with 4 additions and 4 deletions

View File

@@ -6,11 +6,11 @@ import tachiyomi.core.util.system.ImageUtil
import java.io.InputStream
object SevenZUtil {
fun SevenZFile.getImages(): Sequence<InputStream> {
fun SevenZFile.getImages(): Sequence<ByteArray> {
return generateSequence { runCatching { getNextEntry() }.getOrNull() }
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { getInputStream(it) } }
.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
.map(::getInputStream)
.map { it.use(InputStream::readBytes).inputStream() } // ByteArrayInputStream
.map { it.use(InputStream::readBytes) } // ByteArray
}
}