diff --git a/ERRORCODES.md b/ERRORCODES.md index 5d0e140717..2c0c77991a 100644 --- a/ERRORCODES.md +++ b/ERRORCODES.md @@ -36,3 +36,4 @@ | ERR_1030 | ComicRack CBL has no Name element | | ERR_1031 | ComicRack CBL Book is missing series or number | | ERR_1032 | EPUB file has wrong media type | +| ERR_1033 | Some entries are missing | diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index f77283c7c4..b02603a0c5 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -764,7 +764,8 @@ "ERR_1029": "ComicRack CBL does not contain any Book element", "ERR_1030": "ComicRack CBL has no Name element", "ERR_1031": "ComicRack CBL Book is missing series or number", - "ERR_1032": "EPUB file has wrong media type" + "ERR_1032": "EPUB file has wrong media type", + "ERR_1033": "Some entries are missing" }, "filter": { "age_rating": "age rating", diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt index e3c9022b9f..46fca1e1d3 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt @@ -129,6 +129,10 @@ class BookAnalyzer( private fun analyzeEpub(book: Book, analyzeDimensions: Boolean): Media { val manifest = epubExtractor.getManifest(book.path, analyzeDimensions) + val entriesErrorSummary = manifest.missingResources + .map { it.fileName } + .ifEmpty { null } + ?.joinToString(prefix = "ERR_1033 [", postfix = "]") { it } return Media( status = Media.Status.READY, pages = manifest.divinaPages, @@ -142,6 +146,7 @@ class BookAnalyzer( isFixedLayout = manifest.isFixedLayout, positions = manifest.positions, ), + comment = entriesErrorSummary, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt index 0eeed14e03..2610a29038 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt @@ -69,11 +69,12 @@ class EpubExtractor( fun getManifest(path: Path, analyzeDimensions: Boolean): EpubManifest = path.epub { epub -> - val resources = getResources(epub) + val (resources, missingResources) = getResources(epub).partition { it.fileSize != null } val isFixedLayout = isFixedLayout(epub) val pageCount = computePageCount(epub) EpubManifest( resources = resources, + missingResources = missingResources, toc = getToc(epub), landmarks = getLandmarks(epub), pageList = getPageList(epub), diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubManifest.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubManifest.kt index 32a999ecdc..ab64f01c04 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubManifest.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubManifest.kt @@ -7,6 +7,7 @@ import org.gotson.komga.domain.model.R2Locator data class EpubManifest( val resources: List, + val missingResources: List, val toc: List, val landmarks: List, val pageList: List,