Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash due to title tag missing in opf index #109

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/src/main/java/com/starry/myne/epub/EpubParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ data class EpubFile(val absPath: String, val data: ByteArray) {
other as EpubFile

if (absPath != other.absPath) return false
if (!data.contentEquals(other.data)) return false

return true
return data.contentEquals(other.data)
}

override fun hashCode(): Int {
Expand Down Expand Up @@ -95,7 +93,7 @@ private suspend fun parseAndCreateEpubBook(inputStream: FileInputStream): EpubBo
?: throw Exception(".opf file spine section missing")

val metadataTitle = metadata.selectFirstChildTag("dc:title")?.textContent
?: throw Exception(".opf metadata title tag missing")
?: "Unknown Title"

val metadataCoverId = metadata
.selectChildTag("meta")
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/starry/myne/repo/BookRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class BookRepository {
suspend fun getExtraInfo(bookName: String): ExtraInfo? = suspendCoroutine { continuation ->
val encodedName = URLEncoder.encode(bookName, "UTF-8")
val url = "${googleBooksUrl}?q=$encodedName&startIndex=0&maxResults=1&key=$googleApiKey"
println(url)
val request = Request.Builder().get().url(url).build()
okHttpClient.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ fun ReaderDetailScreen(
fontSize = 24.sp,
fontFamily = figeronaFont,
fontWeight = FontWeight.Bold,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.onBackground,
)

Expand Down
Loading