Skip to content

Commit

Permalink
Automatic merge branch 'current-stable' into 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Auto CI committed Nov 4, 2023
2 parents 6334da1 + 8a23342 commit 76656bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class EpubBackendState(private val epubDir: File): OpenFileState {
val keys: List<Key> 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"
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/net/bible/service/sword/epub/EpubBook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fun getConfig(
abbreviation: String,
description: String,
language: String,
version: Long,
about: String,
path: String,
): String = """
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 76656bf

Please sign in to comment.