Bug 177887 - XMP tags do not get deleted
Summary: XMP tags do not get deleted
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Xmp (show other bugs)
Version: 0.10.0
Platform: Compiled Sources Unspecified
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-16 02:37 UTC by Noah Wolf McIlraith
Modified: 2017-08-13 07:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.10.0
Sentry Crash Report:


Attachments
patch for libkexiv2 (2.28 KB, patch)
2009-01-06 23:39 UTC, Marcel Wiesweg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noah Wolf McIlraith 2008-12-16 02:37:51 UTC
Version:           0.10.0-beta6 (using Devel)
Installed from:    Compiled sources

After deselecting a tag and clicking apply (with save to to "Keywords" enabled) the corresponding IPTC tag is deleted, whilst the XMP tag is not.

This causes problems when loading tags from the image, resulting in a previously deleted tag reappearing, in effect preventing the deletion of tags.
Comment 1 Marcel Wiesweg 2009-01-03 17:43:39 UTC
SVN commit 905075 by mwiesweg:

Return true even if no tag was present (but no error occurred and the desired result is reached),
as it is already done for removeIptcTag and removeGPSInfo

CCBUG: 177887


 M  +3 -3      kexiv2.h  
 M  +2 -0      kexiv2exif.cpp  
 M  +2 -0      kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=905075
Comment 2 Marcel Wiesweg 2009-01-03 18:09:59 UTC
SVN commit 905093 by mwiesweg:

Fix logic, do not bail out on success

CCBUG: 177887

 M  +2 -2      dmetadata.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=905093
Comment 3 Marcel Wiesweg 2009-01-03 18:16:58 UTC
Working on this I found three distinct remaining problems for which I need Gilles' opinion:

1) We now set IPTC tags with tag name only, not full tag path. For the 0.9 userbase however, the tag path will never be removed when new names are set.
I think we should put path and names into the oldKeywords list.

2) setXmpKeywords will only add keywords and never remove any. I think we need oldKeywords / newKeywords as with Iptc. Alternatively we need to add a method to removed a specified list of keywords

3) DMetadata::setImageTagsPath has no effect for me. There is no error message, and I traced down to KExiv2::setXmpTagStringSeq and everything seems all right, but with exiv2 from today's SVN the value is not changed in the file. Does it work for you?
Comment 4 caulier.gilles 2009-01-05 13:48:07 UTC
>1) We now set IPTC tags with tag name only, not full tag path. 

Yes, because XMP is used instead ==> UTF8 support and IPTC ascii limitation

>For the 0.9 userbase however, the tag path will never be removed when new >names are set. I think we should put path and names into the oldKeywords list. 

I'm not sure to understand. with 0.9 full path is recorded in IPTC.


>2) setXmpKeywords will only add keywords and never remove any. 

fine for me. note this must be the same with IPTC

>I think we need >oldKeywords / newKeywords as with Iptc. Alternatively we need to add a method to removed a specified list of keywords 

Agree

>3) DMetadata::setImageTagsPath has no effect for me. There is no error message, and I traced down to KExiv2::setXmpTagStringSeq and everything seems all right, but with exiv2 from today's SVN the value is not changed in the file. Does it work for you? 

I will check

IMPORTANT: KDE4.2 will be branched tomorrow. all changes done libkexiv2, libkdcraw, libkipi from trunk need to be backported to KDE 4.2 branch (only if binary compatibility is preserved of course)

Gilles Caulier

Comment 5 Marcel Wiesweg 2009-01-05 17:03:44 UTC
1) 
> I'm not sure to understand. with 0.9 full path is recorded in IPTC.

Yes, we did record the full path. What I mean is, now, if a tag is _removed_, we need to remove both the full path and the name from IPTC - when the tag was added with 0.9, there will be the full path in IPTC.
It can be done easily.

2)
So with all freezing and branching, it would be ok to add
bool KExiv2::removeXmpKeywords(const QStringList& keywordsToRemove, bool setProgramName) const
(and probably similar methods for XmpSubCategories and XmpSubjects)
to libkexiv2 now?
Comment 6 caulier.gilles 2009-01-05 18:42:45 UTC
1/ Ok now i understand.

2/ ok. it's urgent to implement these method now. tomorrow evening, KDE 4.2 is branched and API will be frozen.

Gilles
Comment 7 Marcel Wiesweg 2009-01-06 23:38:39 UTC
I have everything working now on my machine, that is all three points above are
fixed.
There is a bugfix patch for libkexiv2 that I will attach here. I think it is ok
to commit this to trunk and backport to the 4.2 branch, as it is only bugfix.
But I'm not absolutely sure. The problem is that when using xmpData.add for XMP
String Bags and Seqs, somehow values are only added and not removed.

The API-changing patch that I sent to you will have to go to DMetadata as I
understand this. It's prepared and ready to commit. It is suboptimal but we are
late. (We could commit to trunk/ again, but, as 0.10 will depend on 4.2 only,
that would mean more #ifdefs in our code, and probably we wont want to depend
on KDE4.3 but only on KDE4.2 for a longer period.
Comment 8 Marcel Wiesweg 2009-01-06 23:39:27 UTC
Created attachment 29986 [details]
patch for libkexiv2
Comment 9 Marcel Wiesweg 2009-01-07 17:37:48 UTC
SVN commit 907203 by mwiesweg:

Fix setXmpTagStringBag and setXmpTagStringSeq: Using XmpData::add with these types would
somehow only append and keep all old entries. Replace an existing XmpDatum,
or remove tag altogether if the new list is empty.

CCBUG: 177887


 M  +30 -16    kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907203
Comment 10 Marcel Wiesweg 2009-01-07 17:40:17 UTC
SVN commit 907204 by mwiesweg:

Backport commit 907203:
Fix setXmpTagStringBag and setXmpTagStringSeq: Using XmpData::add with these
types would somehow only append and keep all old entries. Replace an existing XmpDatum,
or remove tag altogether if the new list is empty.

CCBUG: 177887


 M  +30 -16    kexiv2xmp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907204
Comment 11 Marcel Wiesweg 2009-01-07 17:50:03 UTC
SVN commit 907212 by mwiesweg:

- add a common implementation addToXmpTagStringBag and removeFromXmpTagStringBag
  to add a given list of string to / remove from the current entries of a string bag
- implement or reimplement XmpKeywords, Subjects and SubCategories methods
  get, set and remove using the new common implementation.

This patch should normally go to libkexiv2 but didn't make it due to KDE4.2 freeze

CCBUG: 177887

 M  +101 -0    dmetadata.cpp  
 M  +66 -0     dmetadata.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907212
Comment 12 Marcel Wiesweg 2009-01-07 17:50:22 UTC
SVN commit 907214 by mwiesweg:

When removing a tag:
- remove both tag name and tags path from Iptc keywords because tags set with 0.9
  will be written with full path
- remove tag name from Xmp dc.subject

CCBUG: 177887

 M  +8 -6      metadatahub.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907214