mirror of
https://github.com/gotson/komga.git
synced 2025-01-09 04:08:00 +08:00
refactor: remove unused property number in BookPageContent
This commit is contained in:
parent
37e7d55fbe
commit
cb5177db52
@ -1,7 +1,6 @@
|
||||
package org.gotson.komga.domain.model
|
||||
|
||||
class BookPageContent(
|
||||
val number: Int,
|
||||
val content: ByteArray,
|
||||
val mediaType: String,
|
||||
)
|
||||
|
@ -239,7 +239,7 @@ class BookLifecycle(
|
||||
)
|
||||
fun getBookPage(book: Book, number: Int, convertTo: ImageType? = null, resizeTo: Int? = null): BookPageContent {
|
||||
val media = mediaRepository.findById(book.id)
|
||||
val pageContent = bookAnalyzer.getPageContent(BookWithMedia(book, mediaRepository.findById(book.id)), number)
|
||||
val pageContent = bookAnalyzer.getPageContent(BookWithMedia(book, media), number)
|
||||
val pageMediaType = media.pages[number - 1].mediaType
|
||||
|
||||
if (resizeTo != null) {
|
||||
@ -249,7 +249,7 @@ class BookLifecycle(
|
||||
logger.error(e) { "Resize page #$number of book $book to $resizeTo: failed" }
|
||||
throw e
|
||||
}
|
||||
return BookPageContent(number, convertedPage, resizeTargetFormat.mediaType)
|
||||
return BookPageContent(convertedPage, resizeTargetFormat.mediaType)
|
||||
} else {
|
||||
convertTo?.let {
|
||||
val msg = "Convert page #$number of book $book from $pageMediaType to ${it.mediaType}"
|
||||
@ -271,10 +271,10 @@ class BookLifecycle(
|
||||
logger.error(e) { "$msg: conversion failed" }
|
||||
throw e
|
||||
}
|
||||
return BookPageContent(number, convertedPage, it.mediaType)
|
||||
return BookPageContent(convertedPage, it.mediaType)
|
||||
}
|
||||
|
||||
return BookPageContent(number, pageContent, pageMediaType)
|
||||
return BookPageContent(pageContent, pageMediaType)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,6 @@ class TransientBookLifecycle(
|
||||
val pageContent = bookAnalyzer.getPageContent(transientBook, number)
|
||||
val pageMediaType = transientBook.media.pages[number - 1].mediaType
|
||||
|
||||
return BookPageContent(number, pageContent, pageMediaType)
|
||||
return BookPageContent(pageContent, pageMediaType)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user