Bug 430303

Summary: Some XMP Namespaces missing from Configure/Metadata/Views dialog [patch]
Product: [Applications] digikam Reporter: David Haslam <dch.code>
Component: Metadata-XmpAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version: 7.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 7.2.0
Sentry Crash Report:
Attachments: Patch #1

Description David Haslam 2020-12-12 15:11:44 UTC
Created attachment 134033 [details]
Patch #1

SUMMARY I've been playing with digiKam to check how well it works
alongside qeeqie and darktable, particularly relating to tagging. I
discovered that I wasn't able to view certain XMP properties, for
example lr:hierarchicalSubject. On looking closer I noticed that there
are several XMP namespaces missing from the configuration dialog.

STEPS TO REPRODUCE
1. Menu bar - Configure - Configure DigiKam..
2. Select Metadata on left
3. Select tab Views
4. Select tab XMP
5. Enter hierarch in the search box
6. Scroll up and down looking in vain for the "Lightroom Schema"
   or use the search box to look for "hierarch"

OBSERVED RESULT
Nothing found, no matches for search.

EXPECTED RESULT
An entry for hierarchicalSubject under the Adobe Lightroom Schema

SOFTWARE/OS VERSIONS
Ubuntu 20.04.1
Qt Version: 5.12.8

ADDITIONAL INFORMATION

I decided to try and fix this, and have attached a suggested patch.

Following is some details on what the patch does.

The fix starts with this function:
    MetaEngine::TagsMap MetaEngine::getXmpTagsList()
In this file:
    core/libs/metadataengine/engine/metaengine_xmp.cpp.
In here we see a list of calls similar to:
    d->getXMPTagsListFromPrefix(QLatin1String("dc"),             tagsMap);
but only a subset of the exvi2 supported namespaces appear.

So it would seem to be a simple matter to add another line:
    d->getXMPTagsListFromPrefix(QLatin1String("lr"),             tagsMap);

However that is not sufficient, as within this function:
    bool MetaEngine::initializeExiv2()
in this file:
    core/libs/metadataengine/engine/metaengine.cpp

We see several cals to register new namespaces, like this:
    registerXmpNameSpace(QLatin1String("http://ns.adobe.com/lightroom/1.0/"),  QLatin1String("lr"));

But these calls are not required, as all the namespaces are already included in exiv2 since 0.27. In fact these extra registrations overlay the exiv2 builtin registrations and remove access to the propery list. So they should all be removed.

One final step is needed:
In this contrstructor:
    MdKeyListViewItem::MdKeyListViewItem(QTreeWidget* const parent, const QString& key)
In file:
    core/libs/widgets/metadata/mdkeylistviewitem.cpp
There is code to convert the namespace prefix to a meaningful title to be displayed in the dialog.

I've attached a patch against master that does this minor edit to the three files.

There's probably better ways of fixing this (maybe we should iterate
over all Exiv2 namespaces) but i hoped this simple fix could be
applied ready for the next release, Meanwhile I might continue looking
at tidying this code a bit, in slow time. This is my first fix, so I'm
starting slowly.


Thanks.
Comment 1 Maik Qualmann 2020-12-12 16:17:39 UTC
Git commit 1444c5221a1449eaefa5b61c104ea86aa039a20d by Maik Qualmann.
Committed on 12/12/2020 at 16:15.
Pushed by mqualmann into branch 'master'.

apply patch #134033 from David Haslam to add some missing XMP Namespaces
FIXED-IN: 7.2.0

M  +0    -12   core/libs/metadataengine/engine/metaengine.cpp
M  +5    -0    core/libs/metadataengine/engine/metaengine_xmp.cpp
M  +20   -0    core/libs/widgets/metadata/mdkeylistviewitem.cpp

https://invent.kde.org/graphics/digikam/commit/1444c5221a1449eaefa5b61c104ea86aa039a20d