Bug 313203

Summary: Metadata editor doesn't recognize contact info written with digikam 2.6 and higher [patch]
Product: [Applications] digikam Reporter: Knut Hildebrandt <knut.hildebrandt>
Component: Plugin-Generic-MetadataEditAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: alan.pater, caulier.gilles, knut.hildebrandt
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.2.0
Attachments: Test image with metadata added by digikam
Quick patch to use nested properties
Improved patch to nest xmp.iptc tags
Prefers nested tags, removes non-nested
Patch to prefer nested tags and replace non-nested
MetadataEdit XMP Credits nested version

Description Knut Hildebrandt 2013-01-13 20:11:40 UTC
A month ago I filed a bug against digikam because apparently no contact info was written into jpg-files by all versions greater than 2.6 (https://bugs.kde.org/show_bug.cgi?id=309254).

As it turned out, the contact information actually is written into the pictures but in a different manner than in digikam2.5 due to fixing a bug. They can be seen in digikams metadata viewer as well as using exiv2.

Nevertheless they can't be accessed through the kipi metadata editor. The respective fields are greyed out. And when I add the contact info using the kipi plugin a second set of tag is added to the jpg- file. This holds true for the plugin coming with digikam3.0.0 (compiled from git sources) as well as for the one used by gwenview 2.8.4.
.

Reproducible: Always

Steps to Reproduce:
1. write contact info from template into a jpg-file using digikam3.0.0
2. view metadata in metadata viewer of digikam -> it's there
3. open kipi metadata editor (image/metadata/edit all metadata) -> contact info is missing
4. add contact info in kipi metadata editor
5. view metadata in digikam -> it appears a second, slightly different, set of tags containing the contact informat
Actual Results:  
Got a second set of xml tags.

Expected Results:  
Would expect that digikam and kipi plugins use the same set of meta tags. Nevertheless tags written with older version of digikam (2.5 and less) should be visible and editable in kipi metadata editor as well.
Comment 1 Alan Pater 2014-01-05 22:54:13 UTC
Created attachment 84473 [details]
Test image with metadata added by digikam

I have tested version 3.4 and the same issue is still coming up, Contact Info tabs are written at the root level rather then nested.

I opened a bug on Launchpad before seeing this here: 
   https://bugs.launchpad.net/ubuntu/+source/digikam/+bug/1266289
Comment 2 Alan Pater 2014-01-06 00:06:28 UTC
The properties that should be written to are:  

        Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdr*

Currently, metadataedit is writing to:  

        Xmp.iptc.CiAdr*

This can happen because exiv2 does not enforce correct XMP nested properties, but allows XMP properties and XMP classes to be interchanged at will by applications.
Comment 3 Alan Pater 2014-01-06 13:34:51 UTC
Created attachment 84478 [details]
Quick patch to use nested properties

A quick Find & Replace on xmpcredits.cpp resulted in the attached diff. Should work, no?
Comment 4 Alan Pater 2014-02-14 23:28:20 UTC
Created attachment 85155 [details]
Improved patch to nest xmp.iptc tags

This patch is tested and working.

It writes the full nested tags by default.
It reads the first of the non-nested and nested tags that already exist in an image.

What it does not do is replace the non-nested with a correct nested tag.
To do that, the user needs to uncheck the field for the tag and then rewrite it.
Comment 5 Alan Pater 2014-02-25 01:49:29 UTC
Created attachment 85313 [details]
Prefers nested tags, removes non-nested

This version allows the correct nested tags, if they exist, to be preferred. It also deletes the non-nested tags and writes the nested version.
Comment 6 Alan Pater 2014-04-19 23:30:14 UTC
Created attachment 86179 [details]
Patch to prefer nested tags and replace non-nested
Comment 7 Alan Pater 2014-04-20 12:11:27 UTC
As Knut indicated, the change in Digikam happened between version 2.5 and version 2.6.

https://bugs.kde.org/show_bug.cgi?id=287267 - IptcCore tags are written incorrectly.
Comment 8 Alan Pater 2014-04-23 02:47:15 UTC
Created attachment 86224 [details]
MetadataEdit XMP Credits nested version

Tested using kipi-plugins package built for Ubuntu Trusty on https://launchpad.net/~alan-pater/+archive/dwc

It reads nested and/or non-nested tags. It writes only nested tags and converts non-nested tags to nested.
Comment 9 Marcel Wiesweg 2014-06-30 21:03:00 UTC
Git commit 6414115e0f9d8f28240fb75180d0353938eb30c4 by Marcel Wiesweg.
Committed on 30/06/2014 at 21:02.
Pushed by mwiesweg into branch 'master'.

Apply patch by Alan Pater

M  +101  -14   metadataedit/xmp/xmpcredits.cpp

http://commits.kde.org/kipi-plugins/6414115e0f9d8f28240fb75180d0353938eb30c4