Some more cleanup to Save as CBZ
This commit is contained in:
parent
4870bb153d
commit
0abee585fc
@ -40,7 +40,7 @@ class DownloadPageLoader(
|
|||||||
override fun getPages(): Observable<List<ReaderPage>> {
|
override fun getPages(): Observable<List<ReaderPage>> {
|
||||||
val chapterPath = downloadProvider.findChapterDir(chapter.chapter, manga, source)
|
val chapterPath = downloadProvider.findChapterDir(chapter.chapter, manga, source)
|
||||||
|
|
||||||
if (chapterPath?.isFile!!) {
|
if (chapterPath?.isFile == true) {
|
||||||
val zip = if (!File(chapterPath.filePath!!).canRead()) {
|
val zip = if (!File(chapterPath.filePath!!).canRead()) {
|
||||||
val tmpFile = File.createTempFile(chapterPath.name!!.replace(".cbz", ""), ".cbz")
|
val tmpFile = File.createTempFile(chapterPath.name!!.replace(".cbz", ""), ".cbz")
|
||||||
val buffer = ByteArray(1024)
|
val buffer = ByteArray(1024)
|
||||||
@ -59,7 +59,7 @@ class DownloadPageLoader(
|
|||||||
|
|
||||||
return zip.entries().toList()
|
return zip.entries().toList()
|
||||||
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { zip.getInputStream(it) } }
|
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { zip.getInputStream(it) } }
|
||||||
.sortedWith(Comparator<ZipEntry> { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) })
|
.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
|
||||||
.mapIndexed { i, entry ->
|
.mapIndexed { i, entry ->
|
||||||
val streamFn = { zip.getInputStream(entry) }
|
val streamFn = { zip.getInputStream(entry) }
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user