gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
4.13k stars 244 forks source link

Unlocked tags not removed on metadata refresh #1689

Closed jvkohler closed 2 months ago

jvkohler commented 2 months ago

Steps to reproduce

  1. Scan comic into Komga with embedded ComicRack data that includes tags.
  2. Edit the embedded data with ComicRack and remove the tags, update the embedded data.
  3. Refresh metadata in Komga

Expected behavior

Unlocked tags should be removed when not present in the embedded metadata

Actual behavior

Tags not present in the metadata are kept in Komga, with no way I can find to mass remove them.

Logs

No response

Komga version

1.12.1-master

Operating system

Docker on Debian Linux

Installation method

Docker

Other details

This seems related to #1498, but I can't add to that report directly.

That issue was closed due to ComicInfo not differentiating between missing and empty fields. I put forward the idea that when building metadata for an object, these are equivalent. An empty field is the same as a missing field, in that it has no information to be added to the accumulated metadata model. It's not meant to use blank entries in ComicInfo to suppress lower priority metadata layers, and responsibility for the correctness of the ComicInfo metadata would fall to the owner of the file. Komga can safely assume that the ComicInfo is authoritative with the only higher priority metadata source being locked fields in the Komga database. This would free Komga from having to provide bulk data management to the same extent as external tools.

Acknowledgements

gotson commented 2 months ago

that's not how things work in Komga. Metadata fields that are collections are added upon. Metadata fields that are single field are overriden.

There could be multiple metadata providers contributing to one book or series, that's why it's additive.

jvkohler commented 2 months ago

That's how I was assuming it worked so perhaps I'm not being clear on what the issue is as I see it. Komga is retaining unlocked information sourced from the Komga DB during metadata refresh. This is unintuitive, as one expects a refresh to build a new metadata set from the configured providers. Komga's existing DB unlocked metadata fields should not be used in any part of the metadata refresh. Locked fields should obviously work as you described.

gotson commented 2 months ago

you're understanding is incorrect. Metadata providers only add data. If a field is single valued, it would override the value. If a field is a list/collection, it only adds to it.