Skip non-existing local chapters

master
Koitharu 1 year ago
parent 15f37644c0
commit 1c6a125174
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -67,14 +67,19 @@ class LocalMangaParser(private val uri: Uri) {
coverUrl = coverEntry?.let { uri.child(it, resolve = true).toString() }.orEmpty(), coverUrl = coverEntry?.let { uri.child(it, resolve = true).toString() }.orEmpty(),
largeCoverUrl = null, largeCoverUrl = null,
chapters = if (withDetails) { chapters = if (withDetails) {
mangaInfo.chapters?.map { c -> mangaInfo.chapters?.mapNotNull { c ->
val path = index.getChapterFileName(c.id)?.toPath()
if (path != null && !fileSystem.exists(rootPath / path)) {
null
} else {
c.copyInternal( c.copyInternal(
url = index.getChapterFileName(c.id)?.toPath()?.let { url = path?.let {
uri.child(it, resolve = false).toString() uri.child(it, resolve = false).toString()
} ?: uri.toString(), } ?: uri.toString(),
source = LocalMangaSource, source = LocalMangaSource,
) )
} }
}
} else { } else {
null null
}, },

Loading…
Cancel
Save