mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix ComicInfo.xml not being read if .noxml file exists too (#8111)
* gives ComicInfo.xml files priority over noxml files if both are at the chapter root. * delete the noxml file if both a noXml file and a ComicInfo file exist
This commit is contained in:
parent
ef2c9460b5
commit
80b2ebc45b
1 changed files with 8 additions and 5 deletions
|
@ -150,17 +150,20 @@ class LocalSource(
|
||||||
// Augment manga details based on metadata files
|
// Augment manga details based on metadata files
|
||||||
try {
|
try {
|
||||||
val mangaDirFiles = getMangaDirsFiles(manga.url, baseDirsFile).toList()
|
val mangaDirFiles = getMangaDirsFiles(manga.url, baseDirsFile).toList()
|
||||||
val comicInfoMetadata = mangaDirFiles
|
val comicInfoFile = mangaDirFiles
|
||||||
.firstOrNull { it.name == COMIC_INFO_FILE || it.name == ".noxml" }
|
.firstOrNull { it.name == COMIC_INFO_FILE }
|
||||||
|
val noXmlFile = mangaDirFiles
|
||||||
|
.firstOrNull { it.name == ".noxml" }
|
||||||
|
if (comicInfoFile != null && noXmlFile != null) noXmlFile.delete()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
// Top level ComicInfo.xml
|
// Top level ComicInfo.xml
|
||||||
comicInfoMetadata?.name == COMIC_INFO_FILE -> {
|
comicInfoFile != null -> {
|
||||||
setMangaDetailsFromComicInfoFile(comicInfoMetadata.inputStream(), manga)
|
setMangaDetailsFromComicInfoFile(comicInfoFile.inputStream(), manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy ComicInfo.xml from chapter archive to top level if found
|
// Copy ComicInfo.xml from chapter archive to top level if found
|
||||||
comicInfoMetadata == null -> {
|
noXmlFile == null -> {
|
||||||
val chapterArchives = mangaDirFiles
|
val chapterArchives = mangaDirFiles
|
||||||
.filter { isSupportedArchiveFile(it.extension) }
|
.filter { isSupportedArchiveFile(it.extension) }
|
||||||
.toList()
|
.toList()
|
||||||
|
|
Loading…
Reference in a new issue