mirror of
https://github.com/gotson/komga.git
synced 2025-12-16 13:33:49 +01:00
parent
50229db2cf
commit
01a16b718a
1 changed files with 5 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ import org.gotson.komga.domain.persistence.MediaRepository
|
|||
import org.gotson.komga.domain.persistence.ReadListRepository
|
||||
import org.gotson.komga.domain.persistence.ReadProgressRepository
|
||||
import org.gotson.komga.domain.persistence.ThumbnailBookRepository
|
||||
import org.gotson.komga.infrastructure.configuration.KomgaProperties
|
||||
import org.gotson.komga.infrastructure.hash.Hasher
|
||||
import org.gotson.komga.infrastructure.image.ImageConverter
|
||||
import org.gotson.komga.infrastructure.image.ImageType
|
||||
|
|
@ -44,6 +45,7 @@ class BookLifecycle(
|
|||
private val eventPublisher: EventPublisher,
|
||||
private val transactionTemplate: TransactionTemplate,
|
||||
private val hasher: Hasher,
|
||||
private val komgaProperties: KomgaProperties,
|
||||
) {
|
||||
|
||||
fun analyzeAndPersist(book: Book): Boolean {
|
||||
|
|
@ -67,6 +69,9 @@ class BookLifecycle(
|
|||
}
|
||||
|
||||
fun hashAndPersist(book: Book) {
|
||||
if (!komgaProperties.fileHashing)
|
||||
return logger.info { "File hashing is disabled, it may have changed since the task was submitted, skipping" }
|
||||
|
||||
logger.info { "Hash and persist book: $book" }
|
||||
if (book.fileHash.isBlank()) {
|
||||
val hash = hasher.computeHash(book.path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue