metadata: fixed glitches in importing IPTC tags

(cherry picked from commit 3d03f654e22ca01f058492eab2c8fcbc564dc1b9)
This commit is contained in:
Alberto Griggio 2021-11-16 23:21:40 -08:00 committed by Lawrence Lee
parent f2248dce9d
commit 2ce81cccc5
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F
2 changed files with 373 additions and 346 deletions

View File

@ -198,6 +198,7 @@ void Exiv2Metadata::do_merge_xmp(Exiv2::Image *dst, bool keep_all) const
Exiv2::IptcData iptc;
Exiv2::copyXmpToIptc(xmp, iptc);
Exiv2::moveXmpToExif(xmp, exif);
std::unordered_set<std::string> seen;
if (!keep_all) {
remove_unwanted(exif);
@ -207,10 +208,18 @@ void Exiv2Metadata::do_merge_xmp(Exiv2::Image *dst, bool keep_all) const
dst->exifData()[datum.key()] = datum;
}
for (auto &datum : iptc) {
dst->iptcData()[datum.key()] = datum;
if (seen.insert(datum.key()).second) {
dst->iptcData()[datum.key()] = datum;
} else {
dst->iptcData().add(datum);
}
}
for (auto &datum : xmp) {
dst->xmpData()[datum.key()] = datum;
if (seen.insert(datum.key()).second) {
dst->xmpData()[datum.key()] = datum;
} else {
dst->xmpData().add(datum);
}
}
} catch (std::exception &exc) {
if (settings->verbose) {

File diff suppressed because it is too large Load Diff