Bug 274029 - Edit Metadata dialog doesn't honour settings for XMP sidecar [patch]
Summary: Edit Metadata dialog doesn't honour settings for XMP sidecar [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-MetadataEdit (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-24 14:58 UTC by Daniel Berrange
Modified: 2016-07-17 04:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.0


Attachments
Fix kipi-plugins to load digikam settings before load/save of metadata via KExiv2 (6.92 KB, patch)
2011-05-24 15:05 UTC, Daniel Berrange
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Berrange 2011-05-24 14:58:43 UTC
Version:           2.0.0 (using KDE 4.6.3) 
OS:                Linux

I am using digikam 2.0.0, beta5, compiled from source. 

I have changed the default digikam settings to enable 'Read metadata from XML sidecar files' and change 'Metadata writing mode' to 'Write to XMP sidecar only'


From the main album view, if I now select an image and then use the menu 'Image -> Metadata -> Edit Metadata', it does not populate the dialog with metadata from any existing XMP sidecar file. If I make metadata changes and then apply them, they are saved directly into the image file and no XMP sidecar is created.

In essence, changes to the 'Read metadata from XMP sidecar' and 'Metadata writing mode' settings have no effect on the metadata dialog at all.


Reproducible: Always

Steps to Reproduce:
1. Open menu 'Settings' -> 'Configure Digikam'
2. Select the 'Metadata' settings page
3. Enable 'Read metadata from XMP sidecar'
4. Change 'Metadata writing mode' to 'Write to XMP sidecar only'
5. Press OK to apply settings & close dialog
6. Select an image which has an XMP sidecar file with 'Headline' field set
7. Open menu 'Image -> Metadata -> Edit All Metadata'
8. Switch to 'Edit XMP' tab
8. Look at existing metadata that is loaded for 'Headline'
9. Make a change to the 'Headline'
10. Press 'Apply'


Actual Results:  
In step 8, the 'headline' field is not populated with data from the XMP sidecar.
In step 10, the change is written directly into the JPG file, and the XMP sidecar is unchanged. If there was no existing XMP sidecar in step 10, none is created either.


Expected Results:  
In step 8, the 'headline' contains the data from the XMP sidecar

In step 10, an XMP sidecar file should be created, or the existing one updated. No change must be made to the original JPG (as per 'Metadata writing mode' setting changed made earlier)
Comment 1 Daniel Berrange 2011-05-24 15:05:12 UTC
Created attachment 60270 [details]
Fix kipi-plugins to load digikam settings before load/save of metadata via KExiv2

Debugging the code revealed that the use of the KExiv2 class in extra/kipi-plugins/metadataedit/ was incorrect. Some places did not apply any of the Digikam settings for metadata usage, and others only applied the WriteMetadataUpdateFiletimeStamp & WriteMetadataToRAW settings.

The usage pattern of KExiv2 seems rather error-prone, requiring every piece of code to remember to manually load digikam metadata settings into the object instance. I wasn't sure of the history and/plans for improving this, so rather than re-factor it myself, I'm providing a minimal patch which simply follows the current coding practice. Specifically the patch just updates all code in extra/kipi-plugins/metadataedit/  to apply WriteMetadataToRAW, MetadataWritingMode, UseXMPSidecar4Reading and WriteMetadataUpdateFiletimeStamp.

In my testing, this makes the 'Edit All Metadata' dialog correctly handle XMP sidecars as per digikam settings. Some of the kipi-plugins look like they might also need work in this area though.
Comment 2 caulier.gilles 2011-05-24 15:18:28 UTC
Thanks Daniel for your patch...

As MetadataEdit plugin is not alone to play with digiKam kipi host settings about metadata, i recommend to create in libkipiplugins a small metadatasettings container common to all plugins with a method to setup all KExiv2 configuration from a kipi interface. This will limit duplicate code everywhere.

Gilles Caulier
Comment 3 caulier.gilles 2011-12-20 10:14:59 UTC
Daniel,

Do you see my comment #2 ?

Can you update your patch against git/master ?

Gilles Caulier
Comment 4 caulier.gilles 2012-06-22 08:56:13 UTC
Official Kipi-plugins 2.6.0 release is out since few days now :

http://www.digikam.org/drupal/node/656

Please, check if this entry still valid, or update report accordingly.

Thanks in advance.

Gilles Caulier
Comment 5 Smit Mehta 2013-04-13 14:03:20 UTC
patching file utilities/scripts/cleanup_digikamdb/cleanup_digikamdb.1
patching file utilities/scripts/digitaglinktree/digitaglinktree.1
Hunk #4 FAILED at 72.
Hunk #8 FAILED at 173.
2 out of 8 hunks FAILED -- saving rejects to file utilities/scripts/digitaglinktree/digitaglinktree.1.rej
patching file utilities/kipiiface/kipiinterface.cpp
Hunk #1 FAILED at 173.
1 out of 1 hunk FAILED -- saving rejects to file utilities/kipiiface/kipiinterface.cpp.rej
Comment 6 Smit Mehta 2013-04-13 14:04:09 UTC
Damn. Kindly ignore the last comment.
Comment 7 caulier.gilles 2015-05-10 08:50:48 UTC
The patch provided here is obsolete

Now in kipi plugins, we use KPMetadata class which wrap kipi host settings to KExiv2, especially xmp sidecar handling.

Gilles