Skip to content

Commit

Permalink
fix(kobo): correctly propagate metadata update during kobo sync
Browse files Browse the repository at this point in the history
Massive thanks to @tsheinen for this!
  • Loading branch information
gotson committed Sep 2, 2024
1 parent fcde9c9 commit 20e7c29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.gotson.komga.interfaces.api.kobo.dto.AuthDto
import org.gotson.komga.interfaces.api.kobo.dto.BookEntitlementContainerDto
import org.gotson.komga.interfaces.api.kobo.dto.BookmarkDto
import org.gotson.komga.interfaces.api.kobo.dto.ChangedEntitlementDto
import org.gotson.komga.interfaces.api.kobo.dto.ChangedProductMetadataDto
import org.gotson.komga.interfaces.api.kobo.dto.ChangedReadingStateDto
import org.gotson.komga.interfaces.api.kobo.dto.KoboBookMetadataDto
import org.gotson.komga.interfaces.api.kobo.dto.NewEntitlementDto
Expand Down Expand Up @@ -282,7 +283,7 @@ class KoboController(
)
addAll(
booksChanged.content.map {
ChangedEntitlementDto(
NewEntitlementDto(
BookEntitlementContainerDto(
bookEntitlement = it.toBookEntitlementDto(false),
bookMetadata = metadata[it.bookId]!!,
Expand All @@ -291,6 +292,11 @@ class KoboController(
)
},
)
addAll(
booksChanged.content.map {
ChangedProductMetadataDto(metadata[it.bookId]!!)
},
)
addAll(
booksRemoved.content.map {
ChangedEntitlementDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ data class ChangedEntitlementDto(
val changedEntitlement: BookEntitlementContainerDto,
) : SyncResultDto

@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
data class ChangedProductMetadataDto(
val changedProductMetadata: KoboBookMetadataDto,
) : SyncResultDto

@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
data class NewTagDto(
val newTag: TagDto,
Expand Down

0 comments on commit 20e7c29

Please sign in to comment.