diff --git a/app/src/main/java/net/bible/service/sword/epub/EpubBackendState.kt b/app/src/main/java/net/bible/service/sword/epub/EpubBackendState.kt index 27dcb152c0..1d5d53aa42 100644 --- a/app/src/main/java/net/bible/service/sword/epub/EpubBackendState.kt +++ b/app/src/main/java/net/bible/service/sword/epub/EpubBackendState.kt @@ -187,7 +187,7 @@ class EpubBackendState(private val epubDir: File): OpenFileState { val keys: List get() = dao.fragments().map { getKey(it) } internal val fragDir get() = File(epubDir, "optimized") - + internal val versionFile = File(fragDir, "version.txt") internal val optimizeLockFile = File(epubDir, "optimize.lock") private val epubDbFilename = "optimized.sqlite3.gz" @@ -223,12 +223,14 @@ class EpubBackendState(private val epubDir: File): OpenFileState { val description = queryMetadata("description")?: epubDir.name //TODO: should de-encode html stuff val abbreviation = title //.slice(0 .. min(5, title.length - 1)) val language = queryMetadata("language") ?: "en" + val optimizerVersion = try { String(versionFile.readBytes()).toLong() } catch (e: Exception) {1} val conf = getConfig( initials = initials, abbreviation = abbreviation, description = title, about = description, language = language, + version = optimizerVersion, path = epubDir.toRelativeString(SharedConstants.modulesDir) ) Log.i(TAG, "Creating EpubBook metadata $initials, $description $language") diff --git a/app/src/main/java/net/bible/service/sword/epub/EpubBook.kt b/app/src/main/java/net/bible/service/sword/epub/EpubBook.kt index 9cbccb9016..50fa9937be 100644 --- a/app/src/main/java/net/bible/service/sword/epub/EpubBook.kt +++ b/app/src/main/java/net/bible/service/sword/epub/EpubBook.kt @@ -50,6 +50,7 @@ fun getConfig( abbreviation: String, description: String, language: String, + version: Long, about: String, path: String, ): String = """ @@ -60,7 +61,7 @@ Category=${BookCategory.GENERAL_BOOK.name} AndBibleEpubModule=1 AndBibleEpubDir=$path Lang=$language -Version=0.0 +Version=$version Encoding=UTF-8 SourceType=OSIS ModDrv=RawGenBook diff --git a/app/src/main/java/net/bible/service/sword/epub/EpubOptimization.kt b/app/src/main/java/net/bible/service/sword/epub/EpubOptimization.kt index 44a9a70312..a2b52d376a 100644 --- a/app/src/main/java/net/bible/service/sword/epub/EpubOptimization.kt +++ b/app/src/main/java/net/bible/service/sword/epub/EpubOptimization.kt @@ -262,7 +262,6 @@ fun EpubBackendState.optimizeEpub() { } fileForOriginalId(k)?.delete() } - val versionFile = File(fragDir, "version.txt") versionFile.outputStream().use { it.write("$EPUB_OPTIMIZER_VERSION".toByteArray()) }