🛠️ Fix some books cannot parse in EPUB
* Fixed the scenario when the book has "volume.opf" instead of "content.opf"
This commit is contained in:
parent
a3a18e78a5
commit
0077241595
2 changed files with 3 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ class EpubFileParser @Inject constructor() : FileParser {
|
|||
withContext(Dispatchers.IO) {
|
||||
ZipFile(file).use { zip ->
|
||||
val opfEntry = zip.entries().asSequence().find { entry ->
|
||||
entry.name.endsWith("content.opf")
|
||||
entry.name.endsWith(".opf", ignoreCase = true)
|
||||
} ?: return@withContext
|
||||
|
||||
val opfContent = zip
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ class EpubTextParser @Inject constructor(
|
|||
entry.name.endsWith("toc.ncx", ignoreCase = true)
|
||||
}
|
||||
val opfEntry = zip.entries().toList().find { entry ->
|
||||
entry.name.endsWith("content.opf", ignoreCase = true)
|
||||
entry.name.endsWith(".opf", ignoreCase = true)
|
||||
}
|
||||
|
||||
val chapterEntries = zip.getChapterEntries(opfEntry)
|
||||
val chapterTitleEntries = zip.getChapterTitleMapFromToc(tocEntry)
|
||||
|
||||
Log.i(EPUB_TAG, "TOC Entry: ${tocEntry?.name ?: "no toc.ncx"}")
|
||||
Log.i(EPUB_TAG, "OPF Entry: ${opfEntry?.name ?: "no content.opf"}")
|
||||
Log.i(EPUB_TAG, "OPF Entry: ${opfEntry?.name ?: "no .opf entry"}")
|
||||
Log.i(EPUB_TAG, "Chapter entries, size: ${chapterEntries.size}")
|
||||
Log.i(EPUB_TAG, "Title entries, size: ${chapterTitleEntries?.size}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue