mirror of
https://github.com/gotson/komga.git
synced 2026-05-17 11:33:19 +02: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.ReadListRepository
|
||||||
import org.gotson.komga.domain.persistence.ReadProgressRepository
|
import org.gotson.komga.domain.persistence.ReadProgressRepository
|
||||||
import org.gotson.komga.domain.persistence.ThumbnailBookRepository
|
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.hash.Hasher
|
||||||
import org.gotson.komga.infrastructure.image.ImageConverter
|
import org.gotson.komga.infrastructure.image.ImageConverter
|
||||||
import org.gotson.komga.infrastructure.image.ImageType
|
import org.gotson.komga.infrastructure.image.ImageType
|
||||||
|
|
@ -44,6 +45,7 @@ class BookLifecycle(
|
||||||
private val eventPublisher: EventPublisher,
|
private val eventPublisher: EventPublisher,
|
||||||
private val transactionTemplate: TransactionTemplate,
|
private val transactionTemplate: TransactionTemplate,
|
||||||
private val hasher: Hasher,
|
private val hasher: Hasher,
|
||||||
|
private val komgaProperties: KomgaProperties,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun analyzeAndPersist(book: Book): Boolean {
|
fun analyzeAndPersist(book: Book): Boolean {
|
||||||
|
|
@ -67,6 +69,9 @@ class BookLifecycle(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hashAndPersist(book: Book) {
|
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" }
|
logger.info { "Hash and persist book: $book" }
|
||||||
if (book.fileHash.isBlank()) {
|
if (book.fileHash.isBlank()) {
|
||||||
val hash = hasher.computeHash(book.path)
|
val hash = hasher.computeHash(book.path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue