Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e8214a4
Use metadata for LocalSource
raxod502 Jul 31, 2025
6822673
Update source-local/src/androidMain/kotlin/tachiyomi/source/local/Loc…
raxod502 Aug 2, 2025
aa37be6
Update source-local/src/androidMain/kotlin/tachiyomi/source/local/Loc…
raxod502 Aug 2, 2025
f5e721e
Update source-local/src/androidMain/kotlin/tachiyomi/source/local/Loc…
raxod502 Aug 2, 2025
40ea8ec
Update dependency com.android.tools.build:gradle to v8.12.0 (#2331)
renovate-bot Jul 31, 2025
c75651a
Optimize and cleanup library code (#2329)
AntsyLich Aug 2, 2025
1340df2
Support mass migration for selected library items (#2336)
AntsyLich Aug 2, 2025
bc07837
Support mass migration in 'Browse -> Migrate' (#2338)
AntsyLich Aug 2, 2025
db218f7
Add donate link in more tab
AntsyLich Aug 2, 2025
6a2a971
Remove checksum from release notes and improve download tip
AntsyLich Aug 2, 2025
d7bc0a5
Add changelog entry
raxod502 Aug 2, 2025
2c51866
Refactor
raxod502 Aug 2, 2025
63d4ec2
Support XML files in directories
raxod502 Aug 2, 2025
5cdf4f1
Merge remote-tracking branch 'origin/main' into rr-localsource-metadata
raxod502 Aug 2, 2025
c6dbc55
Update
raxod502 Aug 5, 2025
d062206
Update
raxod502 Aug 5, 2025
02ff67d
Merge remote-tracking branch 'origin/main' into rr-localsource-metadata
raxod502 Aug 5, 2025
2236775
Move changelog
raxod502 Aug 5, 2025
3cb1f54
Update source-local/src/androidMain/kotlin/tachiyomi/source/local/Loc…
raxod502 Aug 6, 2025
f2aad07
Update CHANGELOG.md
raxod502 Aug 6, 2025
20edc3d
Updates
raxod502 Aug 6, 2025
b3b15c1
Merge remote-tracking branch 'origin/main' into rr-localsource-metadata
raxod502 Aug 6, 2025
c6c9d65
fix
raxod502 Aug 6, 2025
a3451b5
fix
raxod502 Aug 6, 2025
d5a2ece
change
raxod502 Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- `Other` - for technical stuff.

## [Unreleased]
### Changed
- LocalSource now reads ComicInfo.xml file for chapter (if available) to display chapter title, number and scanlator ([@raxod502](https://github.com/radian-software)) ([#2332](https://github.com/mihonapp/mihon/pull/2332))

### Fixes
- Fixed scrollbar sometimes not showing during scroll or not reaching the bottom with few items ([@anirudhsnayak](https://github.com/anirudhsnayak)) ([#2304](https://github.com/mihonapp/mihon/pull/2304))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ actual class LocalSource(
noXmlFile == null -> {
val chapterArchives = mangaDirFiles.filter(Archive::isSupported)

val copiedFile = copyComicInfoFileFromArchive(chapterArchives, mangaDir)
val copiedFile = copyComicInfoFileFromChapters(chapterArchives, mangaDir)
if (copiedFile != null) {
setMangaDetailsFromComicInfoFile(copiedFile.openInputStream(), manga)
} else {
Expand All @@ -206,13 +206,24 @@ actual class LocalSource(
return@withIOContext manga
}

private fun copyComicInfoFileFromArchive(chapterArchives: List<UniFile>, folder: UniFile): UniFile? {
private fun <T> getComicInfoForChapter(chapter: UniFile, block: (InputStream) -> T): T? {
if (chapter.isDirectory) {
return chapter.findFile(COMIC_INFO_FILE)?.let { file ->
file.openInputStream().use(block)
}
} else {
return chapter.archiveReader(context).use { reader ->
reader.getInputStream(COMIC_INFO_FILE)?.use(block)
}
}
}

private fun copyComicInfoFileFromChapters(chapterArchives: List<UniFile>, folder: UniFile): UniFile? {
for (chapter in chapterArchives) {
chapter.archiveReader(context).use { reader ->
reader.getInputStream(COMIC_INFO_FILE)?.use { stream ->
return copyComicInfoFile(stream, folder)
}
val file = getComicInfoForChapter(chapter) f@{ stream ->
return@f copyComicInfoFile(stream, folder)
}
if (file != null) return file
}
return null
}
Expand All @@ -225,12 +236,22 @@ actual class LocalSource(
}
}

private fun setMangaDetailsFromComicInfoFile(stream: InputStream, manga: SManga) {
val comicInfo = AndroidXmlReader(stream, StandardCharsets.UTF_8.name()).use {
private fun parseComicInfo(stream: InputStream): ComicInfo {
return AndroidXmlReader(stream, StandardCharsets.UTF_8.name()).use {
xml.decodeFromReader<ComicInfo>(it)
}
}

manga.copyFromComicInfo(comicInfo)
private fun setMangaDetailsFromComicInfoFile(stream: InputStream, manga: SManga) {
manga.copyFromComicInfo(parseComicInfo(stream))
}

private fun setChapterDetailsFromComicInfoFile(stream: InputStream, chapter: SChapter) {
val comicInfo = parseComicInfo(stream)

comicInfo.title?.let { chapter.name = it.value }
comicInfo.number?.value?.toFloatOrNull()?.let { chapter.chapter_number = it }
comicInfo.translator?.let { chapter.scanlator = it.value }
}

// Chapters
Expand All @@ -257,6 +278,10 @@ actual class LocalSource(
format.file.epubReader(context).use { epub ->
epub.fillMetadata(manga, this)
}
} else {
getComicInfoForChapter(chapterFile) { stream ->
setChapterDetailsFromComicInfoFile(stream, this)
}
}
}
}
Expand Down