mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
refactor: add more logs when epub extension is missing
This commit is contained in:
parent
2f9b4e75d2
commit
730b093a5f
2 changed files with 6 additions and 1 deletions
|
|
@ -418,6 +418,7 @@ class BookLifecycle(
|
||||||
val extension =
|
val extension =
|
||||||
mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub
|
mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub
|
||||||
?: throw IllegalArgumentException("Epub extension not found")
|
?: throw IllegalArgumentException("Epub extension not found")
|
||||||
|
.also { logger.error { "Epub extension not found for book ${book.id}. Book should be re-analyzed." } }
|
||||||
extension.positions[page - 1]
|
extension.positions[page - 1]
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|
@ -496,6 +497,7 @@ class BookLifecycle(
|
||||||
val extension =
|
val extension =
|
||||||
mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub
|
mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub
|
||||||
?: throw IllegalArgumentException("Epub extension not found")
|
?: throw IllegalArgumentException("Epub extension not found")
|
||||||
|
.also { logger.error { "Epub extension not found for book ${book.id}. Book should be re-analyzed." } }
|
||||||
// match progression with positions
|
// match progression with positions
|
||||||
val matchingPositions = extension.positions.filter { it.href == href }
|
val matchingPositions = extension.positions.filter { it.href == href }
|
||||||
val matchedPosition =
|
val matchedPosition =
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,10 @@ class KoboController(
|
||||||
locator =
|
locator =
|
||||||
if (koboUpdate.statusInfo.status == StatusDto.FINISHED) {
|
if (koboUpdate.statusInfo.status == StatusDto.FINISHED) {
|
||||||
// If the book is finished, Kobo sends the first resource instead of the last, so we can't trust what Kobo sent
|
// If the book is finished, Kobo sends the first resource instead of the last, so we can't trust what Kobo sent
|
||||||
val epubExtension = mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub ?: throw IllegalArgumentException("Epub extension not found")
|
val epubExtension =
|
||||||
|
mediaRepository.findExtensionByIdOrNull(book.id) as? MediaExtensionEpub
|
||||||
|
?: throw IllegalArgumentException("Epub extension not found")
|
||||||
|
.also { logger.error { "Epub extension not found for book ${book.id}. Book should be re-analyzed." } }
|
||||||
epubExtension.positions.last()
|
epubExtension.positions.last()
|
||||||
} else {
|
} else {
|
||||||
R2Locator(
|
R2Locator(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue