Fix local chapters names (close #1323)

This commit is contained in:
Koitharu
2025-03-15 09:00:25 +02:00
parent 937ed798cf
commit f7c70577ae

View File

@@ -37,6 +37,7 @@ import org.koitharu.kotatsu.parsers.model.MangaChapter
import org.koitharu.kotatsu.parsers.model.MangaPage
import org.koitharu.kotatsu.parsers.util.longHashCode
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
import org.koitharu.kotatsu.parsers.util.toTitleCase
import java.io.File
/**
@@ -113,7 +114,7 @@ class LocalMangaParser(private val uri: Uri) {
}.toString().removePrefix(Path.DIRECTORY_SEPARATOR)
MangaChapter(
id = "$i$s".longHashCode(),
title = null,
title = p.userFriendlyName(),
number = 0f,
volume = 0,
source = LocalMangaSource,
@@ -220,6 +221,10 @@ class LocalMangaParser(private val uri: Uri) {
e.printStackTraceDebug()
}.getOrNull()
private fun Path.userFriendlyName(): String = name.substringBeforeLast('.')
.replace('_', ' ')
.toTitleCase()
private class FsAndPath(
val fileSystem: FileSystem,
val path: Path,