mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
fix(epub): incorrect genres parsing when empty
This commit is contained in:
parent
c25b9cf5f9
commit
8a5abf24fb
1 changed files with 5 additions and 4 deletions
|
|
@ -66,7 +66,7 @@ class EpubMetadataProvider(
|
||||||
val refineRole = authorRoles[id]?.ifBlank { null }
|
val refineRole = authorRoles[id]?.ifBlank { null }
|
||||||
Author(name, relators[opfRole ?: refineRole] ?: "writer")
|
Author(name, relators[opfRole ?: refineRole] ?: "writer")
|
||||||
}
|
}
|
||||||
}
|
}.ifEmpty { null }
|
||||||
|
|
||||||
val isbn = opf.select("metadata > dc|identifier")
|
val isbn = opf.select("metadata > dc|identifier")
|
||||||
?.map { it.text().toLowerCase().removePrefix("isbn:") }
|
?.map { it.text().toLowerCase().removePrefix("isbn:") }
|
||||||
|
|
@ -77,7 +77,7 @@ class EpubMetadataProvider(
|
||||||
title = title,
|
title = title,
|
||||||
summary = description,
|
summary = description,
|
||||||
releaseDate = date,
|
releaseDate = date,
|
||||||
authors = authors.ifEmpty { null },
|
authors = authors,
|
||||||
isbn = isbn,
|
isbn = isbn,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -96,8 +96,9 @@ class EpubMetadataProvider(
|
||||||
val publisher = opf.selectFirst("metadata > dc|publisher")?.text()?.ifBlank { null }
|
val publisher = opf.selectFirst("metadata > dc|publisher")?.text()?.ifBlank { null }
|
||||||
val language = opf.selectFirst("metadata > dc|language")?.text()?.ifBlank { null }
|
val language = opf.selectFirst("metadata > dc|language")?.text()?.ifBlank { null }
|
||||||
val genres = opf.select("metadata > dc|subject")
|
val genres = opf.select("metadata > dc|subject")
|
||||||
?.mapNotNull { it.text() }
|
.mapNotNull { it?.text()?.trim()?.ifBlank { null } }
|
||||||
?.toSet()
|
.toSet()
|
||||||
|
.ifEmpty { null }
|
||||||
|
|
||||||
val direction = opf.getElementsByTag("spine").first().attr("page-progression-direction")?.let {
|
val direction = opf.getElementsByTag("spine").first().attr("page-progression-direction")?.let {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue