diff --git a/.idea/other.xml b/.idea/other.xml
index 0d3a1fb..4604c44 100644
--- a/.idea/other.xml
+++ b/.idea/other.xml
@@ -179,17 +179,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/build.gradle b/app/build.gradle
index ffac17f..266181c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -98,9 +98,9 @@ dependencies {
// Android core components.
implementation 'androidx.core:core-ktx:1.13.1'
- implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
- implementation 'androidx.activity:activity-compose:1.9.0'
- implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.3"
+ implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
+ implementation 'androidx.activity:activity-compose:1.9.1'
+ implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4"
implementation "androidx.navigation:navigation-compose:2.7.7"
// Jetpack compose.
implementation "androidx.compose.ui:ui"
diff --git a/app/src/main/java/com/starry/myne/epub/EpubParser.kt b/app/src/main/java/com/starry/myne/epub/EpubParser.kt
index dbe0a02..3935004 100644
--- a/app/src/main/java/com/starry/myne/epub/EpubParser.kt
+++ b/app/src/main/java/com/starry/myne/epub/EpubParser.kt
@@ -143,18 +143,21 @@ class EpubParser {
document.metadata.selectFirstChildTag("dc:language")?.textContent ?: "en"
val metadataCoverId = document.metadata.selectChildTag("meta")
+ .ifEmpty { document.metadata.selectChildTag("opf:meta") }
.find { it.getAttributeValue("name") == "cover" }?.getAttributeValue("content")
val hrefRootPath = File(document.opfFilePath).parentFile ?: File("")
- val manifestItems = document.manifest.selectChildTag("item").map {
- EpubManifestItem(
- id = it.getAttribute("id"),
- absPath = it.getAttribute("href").decodedURL.hrefAbsolutePath(hrefRootPath),
- mediaType = it.getAttribute("media-type"),
- properties = it.getAttribute("properties")
- )
- }.associateBy { it.id }
+ val manifestItems = document.manifest.selectChildTag("item")
+ .ifEmpty { document.manifest.selectChildTag("opf:item") }
+ .map {
+ EpubManifestItem(
+ id = it.getAttribute("id"),
+ absPath = it.getAttribute("href").decodedURL.hrefAbsolutePath(hrefRootPath),
+ mediaType = it.getAttribute("media-type"),
+ properties = it.getAttribute("properties")
+ )
+ }.associateBy { it.id }
// Find the table of contents (toc.ncx) file.
val tocFileItem = manifestItems.values.firstOrNull {
@@ -223,10 +226,13 @@ class EpubParser {
val document = parseXMLFile(opfFile.data)
?: throw EpubParserException(".opf file failed to parse data")
val metadata = document.selectFirstTag("metadata")
+ ?: document.selectFirstTag("opf:metadata")
?: throw EpubParserException(".opf file metadata section missing")
val manifest = document.selectFirstTag("manifest")
+ ?: document.selectFirstTag("opf:manifest")
?: throw EpubParserException(".opf file manifest section missing")
val spine = document.selectFirstTag("spine")
+ ?: document.selectFirstTag("opf:spine")
?: throw EpubParserException(".opf file spine section missing")
return EpubDocument(metadata, manifest, spine, opfFilePath)
@@ -313,6 +319,7 @@ class EpubParser {
var chapterIndex = 0
val chapterExtensions = listOf("xhtml", "xml", "html", "htm").map { ".$it" }
return spine.selectChildTag("itemref")
+ .ifEmpty { spine.selectChildTag("opf:itemref") }
.mapNotNull { manifestItems[it.getAttribute("idref")] }
.filter { item ->
chapterExtensions.any {