Bug 432761 - reread of XMP metadata leaves tag hierarchy scrambled
Summary: reread of XMP metadata leaves tag hierarchy scrambled
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Xmp (show other bugs)
Version: 6.4.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-10 20:30 UTC by Ervan Darnell
Modified: 2023-06-17 02:01 UTC (History)
3 users (show)

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


Attachments
screen dump of extra hierarchy level in tags (29.60 KB, image/jpeg)
2021-02-10 20:30 UTC, Ervan Darnell
Details
extra hierarchy level for tag "11 Bob" even on version 7.2.0 (28.14 KB, image/jpeg)
2021-02-10 21:17 UTC, Ervan Darnell
Details
Creation of test tags (28.73 KB, image/jpeg)
2021-07-19 18:36 UTC, David Haslam
Details
Test tags assigned to image (27.64 KB, image/jpeg)
2021-07-19 18:36 UTC, David Haslam
Details
Tags after metadata is re-read (27.87 KB, image/jpeg)
2021-07-19 18:37 UTC, David Haslam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ervan Darnell 2021-02-10 20:30:17 UTC
Created attachment 135575 [details]
screen dump of extra hierarchy level in tags

SUMMARY

The tag hierarchy has an extra level that cannot be removed by reassigning the tag.

STEPS TO REPRODUCE
When the .xmp file for a .mp4 is modified like so:
 <lr:hierarchicalSubject>
    <rdf:Bag>
     <rdf:li>2020|11 Bob</rdf:li>

and then "album/reread meta data from files" is used the result is 2020/2020/11 Bob (see attached image for an example).  There is an extra level in the tag hierarchy. 

If I use the Captions/Tags tab to change the tag from 2020/2020/11 Bob to 2020/11 Bob it fails, the tag is left set to 2020/2020/11 Bob.

To reproduce copy the attached .xmp file to <any>.mp4.xmp and rescan the directory.


OBSERVED RESULT
A tag of 2020/2020/11 Bob in the Tags window, and cannot change in the tags manager




EXPECTED RESULT
2020/11 Bob

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

$ uname -a
Linux serval 5.8.0-7630-generic #32~1609193707~20.04~781bb80~dev-Ubuntu SMP Tue Jan 5 21:22:25 U x86_64 x86_64 x86_64 GNU/Linu

ADDITIONAL INFORMATION
The .xmp file (since I cannot apparently attach two files):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:video="http://www.video/"
    xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
    xmlns:audio="http://www.audio/"
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
    xmlns:xmp="http://ns.adobe.com/xap/1.0/"
    xmlns:digiKam="http://www.digikam.org/ns/1.0/"
    xmlns:MicrosoftPhoto="http://ns.microsoft.com/photo/1.0/"
    xmlns:acdsee="http://ns.acdsee.com/iptc/1.0/"
    xmlns:lr="http://ns.adobe.com/lightroom/1.0/"
    xmlns:mediapro="http://ns.iview-multimedia.com/mediapro/1.0/"
    xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
   video:duration="28537"
   video:MaxBitRate="7744897"
   video:StreamCount="2"
   video:Codec="h264"
   video:CodecDescription="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
   video:Format="yuv420p"
   video:ColorMode="smpte170m"
   video:ColorSpace="CCIR-601"
   video:Width="1920"
   video:FrameWidth="1920"
   video:SourceImageWidth="1920"
   video:Height="1080"
   video:FrameHeight="1080"
   video:SourceImageHeight="1080"
   video:FrameSize="w:1920, h:1080, unit:pixels"
   video:AspectRatio="16/9"
   video:FrameRate="56"
   video:BitDepth="24"
   video:Language="und"
   video:TrackCreateDate="3687697442"
   video:HandlerDescription="ISO Media file produced by Google Inc. Created on: 11/08/2020."
   video:MajorBrand="mp42"
   video:CompatibleBrands="isommp42"
   video:MinorVersion="0"
   video:DateTimeOriginal="2020-11-09T00:24:02"
   video:DateUTC="2020-11-09T00:24:02"
   video:ModificationDate="2020-11-09T00:24:02"
   video:DateTimeDigitized="2020-11-09T00:24:02"
   video:FileName="PXL_20201108_232847662.mp4"
   video:FileSize="26"
   video:FileType="mp4"
   video:MimeType="video/mp4"
   xmpDM:duration="28537"
   xmpDM:videoColorSpace="CCIR-601"
   xmpDM:videoFrameSize="w:1920, h:1080, unit:pixels"
   xmpDM:videoPixelAspectRatio="16/9"
   xmpDM:videoFrameRate="Other"
   xmpDM:videoPixelDepth="8Int"
   xmpDM:shotDate="Sun Nov 8 16:24:02 2020"
   xmpDM:audioSampleRate="44100"
   xmpDM:audioChannelType="Stereo"
   xmpDM:audioSampleType="32Float"
   audio:Codec="aac"
   audio:CodecDescription="AAC (Advanced Audio Coding)"
   audio:SampleRate="44100"
   audio:ChannelType="Stereo"
   audio:Format="fltp"
   audio:SampleType="32Float"
   audio:TrackLang="eng"
   audio:TrackCreateDate="3687697442"
   audio:HandlerDescription="ISO Media file produced by Google Inc. Created on: 11/08/2020."
   exif:DateTimeOriginal="2020-11-09T00:24:02"
   exif:DateTimeDigitized="2020-11-09T00:24:02"
   exif:PixelXDimension="1920"
   exif:PixelYDimension="1080"
   tiff:DateTime="2020-11-09T00:24:02"
   tiff:ImageWidth="1920"
   tiff:ImageLength="1080"
   xmp:MetadataDate="2020-11-09T00:24:02"
   xmp:Rating="0"
   xmp:ModifyDate="2020-11-09T00:24:02"
   xmp:CreateDate="2020-11-09T00:24:02"
   digiKam:PickLabel="0"
   digiKam:ColorLabel="0"
   MicrosoftPhoto:Rating="0"
   acdsee:rating="0"
   acdsee:notes="2020/11/08 14:56:19;Target Practice ;;@ Huffaker Springs, east side of Reno"
   acdsee:categories="&lt;Categories&gt;&lt;Category Assigned=&quot;0&quot;&gt;Friends&lt;Category Assigned=&quot;1&quot;&gt;Bob&lt;/Category&gt;&lt;/Category&gt;&lt;Category Assigned=&quot;0&quot;&gt;2020&lt;Category Assigned=&quot;1&quot;&gt;11 Bob&lt;/Category&gt;&lt;/Category&gt;&lt;/Categories&gt;"
   photoshop:DateCreated="2020-11-09T00:24:02"
   photoshop:Urgency="0">
   <exif:UserComment>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">2020/11/08 14:56:19;Target Practice ;;@ Huffaker Springs, east side of Reno</rdf:li>
    </rdf:Alt>
   </exif:UserComment>
   <tiff:ImageDescription>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">2020/11/08 14:56:19;Target Practice ;;@ Huffaker Springs, east side of Reno</rdf:li>
    </rdf:Alt>
   </tiff:ImageDescription>
   <digiKam:TagsList>
    <rdf:Seq>
     <rdf:li>Friends/Bob</rdf:li>
     <rdf:li>2020/11 Bob</rdf:li>
    </rdf:Seq>
   </digiKam:TagsList>
   <digiKam:CaptionsDateTimeStamps>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">2021-02-10T12:06:09</rdf:li>
    </rdf:Alt>
   </digiKam:CaptionsDateTimeStamps>
   <MicrosoftPhoto:LastKeywordXMP>
    <rdf:Bag>
     <rdf:li>Friends/Bob</rdf:li>
     <rdf:li>2020/11 Bob</rdf:li>
    </rdf:Bag>
   </MicrosoftPhoto:LastKeywordXMP>
   <lr:hierarchicalSubject>
    <rdf:Bag>
     <rdf:li>Friends|Bob</rdf:li>
     <rdf:li>2020|11 Bob</rdf:li>
    </rdf:Bag>
   </lr:hierarchicalSubject>
   <mediapro:CatalogSets>
    <rdf:Bag>
     <rdf:li>Friends|Bob</rdf:li>
     <rdf:li>2020|11 Bob</rdf:li>
    </rdf:Bag>
   </mediapro:CatalogSets>
   <dc:subject>
    <rdf:Bag>
     <rdf:li>Bob</rdf:li>
     <rdf:li>11 Bob</rdf:li>
    </rdf:Bag>
   </dc:subject>
   <dc:description>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">2020/11/08 14:56:19;Target Practice ;;@ Huffaker Springs, east side of Reno</rdf:li>
    </rdf:Alt>
   </dc:description>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
Comment 1 Maik Qualmann 2021-02-10 20:51:33 UTC
I cannot reproduce the problem here. It is created quite normally /2020/11 Bob. Tested here with MySQL, what kind of database do you use? Otherwise, please post the output from the terminal with activated debug mode when a re-read of the metadata is carried out. As described here: https://www.digikam.org/contribute/

Furthermore digiKam-6.4.0 is quite old, please try the current AppImage release candidate from digiKam-7.2.0-RC from here: https://files.kde.org/digikam/

Maik
Comment 2 Ervan Darnell 2021-02-10 21:17:07 UTC
Created attachment 135579 [details]
extra hierarchy level for tag "11 Bob" even on version 7.2.0
Comment 3 Ervan Darnell 2021-02-10 21:17:33 UTC
Thanks for the quick reply.  I installed 7.2.0, and let it reread the metadata.  The results are unchanged. The debug log follows.  I'm using the default SQlite database.  

I cannot find the exact issue, but this arose because of the handling between dc:subject and digiKam:TagsList tags in the XMP file.  Originally, it was 2010.11 Bob, where '.' was a hierarchy separator, but that got changed to just '11 Bob' for dc:subject, but digiKam:TagsList kept the full form 
 <rdf:li>2020/11 Bob</rdf:li>

So, it's a munged XMP file at fault in a way, but still when digiKam reparses the XMP file on reread it should not create something completely broken, which 2020/2020/11 Bob is.


Digikam::ScanController::slotRelaxedScanning: Starting scan!
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::CoreDB::clearMetadataFromImage: Clean up the image information, the file will be scanned again
Digikam::MetaEngine::getDigitizationDateTime: DateTime (Exif digitalized): QDateTime(2020-11-09 00:24:02.000 PST Qt::LocalTime)
Digikam::MetaEngine::getDigitizationDateTime: DateTime (XMP-Exif digitalized): QDateTime(2020-11-09 00:24:02.000 PST Qt::LocalTime)
Digikam::ItemMarkerTiler::slotSourceModelReset: ----
Digikam::MetaEngine::getXmpTagStringSeq: XMP String Seq ( Xmp.digiKam.TagsList ):  ("Friends/Bob", "2020/11 Bob")
Digikam::ItemScanner::scanTags: Pick Label found : 0
Digikam::ItemScanner::scanTags: Assigned Pick Label Tag : 15
Digikam::ItemScanner::scanTags: Color Label found : 0
Digikam::ItemScanner::scanTags: Assigned Color Label Tag : 5
Digikam::ItemScanner::commit: Scanning took 96 ms
Digikam::ItemScanner::~ItemScanner: Finishing took 7 ms
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::ThumbnailCreator::createThumbnail: Trying to load video preview with FFmpeg
Digikam::ThumbnailCreator::createThumbnail: Trying to load video preview with FFmpeg
Digikam::ActionThreadBase::setMaximumNumberOfThreads: Using  16  CPU core to run threads
Digikam::ActionThreadBase::run: Action Thread run  1  new jobs
Digikam::ActionThreadBase::slotJobFinished: One job is done
Digikam::ActionThreadBase::cancel: Cancel Main Thread
Digikam::ActionThreadBase::setMaximumNumberOfThreads: Using  16  CPU core to run threads
Digikam::ActionThreadBase::run: Action Thread run  1  new jobs
Digikam::ActionThreadBase::slotJobFinished: One job is done
Digikam::ActionThreadBase::cancel: Cancel Main Thread
Digikam::DBinaryIface::checkDirForPath: Testing  "mysql_install_db" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinaryIface::checkDirForPath: Testing  "mysqld" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinaryIface::checkDirForPath: Testing  "mysql_install_db" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinaryIface::checkDirForPath: Testing  "mysqld" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinaryIface::checkDirForPath: Testing  "././/bin/mysql_install_db" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinarySearch::slotAreBinariesFound: All Binaries Found :  false
Digikam::DBinaryIface::checkDirForPath: Testing  "././/bin/mysqld" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinarySearch::slotAreBinariesFound: All Binaries Found :  false
Digikam::DBinaryIface::checkDirForPath: Testing  "././/sbin/mysql_install_db" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinarySearch::slotAreBinariesFound: All Binaries Found :  false
Digikam::DBinaryIface::checkDirForPath: Testing  "././/sbin/mysqld" ...
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DBinarySearch::slotAreBinariesFound: All Binaries Found :  false
Digikam::DImg::load: "/tmp/.mount_digiKao24k3T/usr/share/digikam/data/sample-aix.png" : "PNG" file identified
unknown: Opening file "/tmp/.mount_digiKao24k3T/usr/share/digikam/data/sample-aix.png"
unknown: PNG in >=8 bits/color/pixel.
unknown: PNG in PNG_COLOR_TYPE_RGB
Comment 4 Maik Qualmann 2021-02-10 21:45:27 UTC
The cause must be different. I cannot reproduce it. What happens if you move "11 Bob" to the top "2020"? If it doesn't work, the tags table is probably damaged. Please then post the messages during the tag move.

Maik
Comment 5 Maik Qualmann 2021-02-10 21:59:12 UTC
Can it be that 2 xmp files exist with you? A BASENAME.xmp file could also be available from which the tag path is read. The order digiKam searches for xmp files is first BASENAME.xmp and then BASENAME.EXT.xmp.

Maik
Comment 6 Ervan Darnell 2021-02-11 02:10:26 UTC
All *xmp files are *.mp4.xmp in the relevant directory, so a duplicate .xmp is not the answer.  I unchecked 2020/2020/11 Bob, checked 2020/11 Bob (in the Tags UI), then clicked "apply".  The log follows.

Your theory there is some problem with the database makes sense as the .XMP seems fine.  I imported many files with x.y keywords.  Some of the get parsed as x/y, some as x/x.y, and some as x.y  (where '/' is the hierarchy separator in digiKam:TagsList).  I was able to clean many of these by manually assigning tags.  So, things are usually working, but there are several cases, 2020/11 Bob one of them, where I cannot clean them up.  I mean that other very similar .XMP files worked, so that only leaves the theory there is something in the database different in this case.

It seems odd to me that digiKam should be keeping any of this state when I explicitly request a metadata reread.  Something is both munged in the database and not being cleaned out.  I'm not willing to share the whole database (as there is a lot of confidential information in there), but I can open it and look at some tables if you tell me where to start on that.

For instance, the tags table contains:
1197	22	11 Bob
1199	1191	11 Bob

The pid of 22 is 0.  The pids for 1191 (in TagsTree) are:
1191	0
1191	22


and 22 in Tags:
22 0  2020

apparently representing 2020/11 Bob and 2020/2020/11 Bob both, but that doesn't explain why I cannot reassign tags.


Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::MetadataHub::writeTags: Writing tags
Digikam::MetadataHub::writeTags: -------------------------- New Keywords ("Bob", "11 Bob")
Digikam::MetaEngine::setIptcKeywords: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"  ==> New Iptc Keywords:  ("11 Bob", "Bob")
Digikam::MetaEngine::save: MetaEngine::metadataWritingMode 3
Digikam::MetaEngine::save: Will write Metadata to file "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::MetaEngine::Private::printExiv2ExceptionError: Cannot save metadata to image using Exiv2   (Error # 11 :  "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4: The file contains data of an unknown image type"
Digikam::MetaEngine::save: Will write XMP sidecar for file "PXL_20201108_232847662.mp4"
Digikam::MetaEngine::Private::saveOperations: wroteComment:  false
Digikam::MetaEngine::Private::saveOperations: wroteEXIF:  true
Digikam::MetaEngine::Private::saveOperations: wroteIPTC:  true
Digikam::MetaEngine::Private::saveOperations: wroteXMP:  true
Digikam::MetaEngine::save: Metadata for file "PXL_20201108_232847662.mp4" written to XMP sidecar.
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::CoreDB::clearMetadataFromImage: Clean up the image information, the file will be scanned again
Digikam::MetaEngine::getDigitizationDateTime: DateTime (Exif digitalized): QDateTime(2020-11-09 00:24:02.000 PST Qt::LocalTime)
Digikam::MetaEngine::getDigitizationDateTime: DateTime (XMP-Exif digitalized): QDateTime(2020-11-09 00:24:02.000 PST Qt::LocalTime)
Digikam::ItemMarkerTiler::slotSourceModelReset: ----
Digikam::MetaEngine::getXmpTagStringSeq: XMP String Seq ( Xmp.digiKam.TagsList ):  ("2020/11 Bob", "Friends/Bob")
Digikam::ItemScanner::scanTags: Pick Label found : 0
Digikam::ItemScanner::scanTags: Assigned Pick Label Tag : 15
Digikam::ItemScanner::scanTags: Color Label found : 0
Digikam::ItemScanner::scanTags: Assigned Color Label Tag : 5
Digikam::ItemScanner::commit: Scanning took 46 ms
Digikam::ItemScanner::~ItemScanner: Finishing took 7 ms
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/home/ervan/Pictures/Personal/2020/11 10 Yosemite/PXL_20201108_232847662.mp4"
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::ThumbnailCreator::createThumbnail: Trying to load video preview with FFmpeg
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "und"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2020-11-09T00:24:02.000000Z")("handler_name", "ISO Media file produced by Google Inc. Created on: 11/08/2020.")("language", "eng"))
Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "isommp42")("creation_time", "2020-11-09T00:24:02.000000Z")("major_brand", "mp42")("minor_version", "0"))
Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
Digikam::ThumbnailCreator::createThumbnail: Trying to load video preview with FFmpeg
Digikam::ActionThreadBase::setMaximumNumberOfThreads: Using  16  CPU core to run threads
Digikam::ActionThreadBase::run: Action Thread run  1  new jobs
Digikam::ActionThreadBase::slotJobFinished: One job is done
Digikam::ActionThreadBase::cancel: Cancel Main Thread
Digikam::ActionThreadBase::setMaximumNumberOfThreads: Using  16  CPU core to run threads
Digikam::ActionThreadBase::run: Action Thread run  1  new jobs
Digikam::ActionThreadBase::slotJobFinished: One job is done
Digikam::ActionThreadBase::cancel: Cancel Main Thread
Comment 7 Ervan Darnell 2021-02-11 02:33:31 UTC
Ok, there is an easy work around:
1) Create tag "temp"
2) Select all 2020/2020/11 Bob pics from the tag manager and assign them to "temp".
3) Delete 2020/2020/11 Bob and 2020/11 Bob tags completely.
4) Rename temp to 2020/11 Bob

I'm still happy to help debug if you care.  Also, the original parsing of x.y is tags somehow buggy and I can help drill down on that if you care.  Thanks for all of the quick replies.
Comment 8 David Haslam 2021-07-19 18:34:37 UTC
I came across a similar problem, while working with a large tag
hierarchy where the same word is used at different levels.

I've been able to reproduce the problem with a clean database and
doing these steps:

1. Use the tag manager to create these tags:
   - "2020/11 Bob"
   - "2020/2020/11 Bob"

   See image tag-hierarchy-1.jpg

2. Create a blank test image, with no metadata. Refresh to view the new image in digikam.
   
3. Select the image and assign "2020" and "2020/11 Bob" to the test image.

   See attachment tag-hierarchy-2.jpg

4. Click Apply to write the metadata (I have digikam configured to write to XMP sidecars).
   
   The XMP file contains:
   
   <digiKam:TagsList>
    <rdf:Seq>
     <rdf:li>2020</rdf:li>
     <rdf:li>2020/11 Bob</rdf:li>
    </rdf:Seq>
   </digiKam:TagsList>

   Which looks correct.

5. Click "More"->"Read Metadata from file to database".

6. Observe that "2020/2020" and "2020/2020/Bob" are now erroneously ticked.
   See attachment tag-hierarchy-3.jpg
      
The fault lies in TagsCache::tagForPath in file
core/libs/database/tags/tagscache.cpp.

This function doesn't properly handle the case of a path with only one level,
and multiple tag paths with the same name.

I've been testing a fix, and a pull request will be sent shortly.
Comment 9 David Haslam 2021-07-19 18:36:07 UTC
Created attachment 140197 [details]
Creation of test tags
Comment 10 David Haslam 2021-07-19 18:36:39 UTC
Created attachment 140198 [details]
Test tags assigned to image
Comment 11 David Haslam 2021-07-19 18:37:23 UTC
Created attachment 140199 [details]
Tags after metadata is re-read
Comment 12 caulier.gilles 2023-04-30 16:04:25 UTC
@Ervan

digiKam 8.0.0 is out. This entry still valid with this release ?

Best regards

Gilles Caulier
Comment 13 caulier.gilles 2023-05-20 12:27:58 UTC
@Ervan Darnell

digiKam 8.1.0 pre-release AppImage bundle is now ported to Exiv2 0.28 which
come with a huge list of bugfixes :

https://github.com/Exiv2/exiv2/issues/2406#issuecomment-1529139799

AppImage file is available here :

https://files.kde.org/digikam/

How to use AppImage under Linux :

https://docs.digikam.org/en/getting_started/installation.html#digikam-on-linux

Thanks in advance for your feedback

Gilles Caulier
Comment 14 Ervan Darnell 2023-06-16 23:59:29 UTC
Confirming the bug does not replicate in 8.x.  Can be closed.