Bug 147885

Summary: update metadata doesn't work correctly for creation date
Product: [Applications] digikam Reporter: bert
Component: Metadata-DateAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahuggel, bert, laidig, marcel.wiesweg
Priority: NOR    
Version: 0.9.2   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:

Description bert 2007-07-15 10:18:16 UTC
Version:           0.9.2 (using KDE KDE 3.5.7)
Installed from:    Debian testing/unstable Packages

It tried to combine some of my pictures with a friends. His camera was however on an entirely different timezone. I discovered this when sorting the pictures in digikam. I then used exiftime to shift the creation date of his pictures 5 hours ahead. In digikam I then used tools-> update metadata database. This correctly changed the date in the metadata info window. However, in the album window, the old time was still displayed and the pictures were not re-sorted. Restarting digikam did not help. I ended up removing the album entirely from digikam and reinserting it.


Regards,

Bert
Comment 1 caulier.gilles 2008-12-05 22:13:36 UTC
Bert,

This report still valid using digiKam 0.9.4 ?

Gilles Caulier
Comment 2 caulier.gilles 2009-06-11 19:27:56 UTC
bert,

This entry still valid with digiKam 0.10.0 ?

Gilles Caulier

Andi : file date is 2007. We will close it if we don't see no more feedback...
Comment 3 Daniel Laidig 2009-06-22 22:41:45 UTC
I can confirm this bug. After using exiv2 to shift the date of lots of pictures, digikam 0.10.0 refuses to update the "Created" property (apparently stored in the ImageInformation table). In the EXIF tab the date was updated, however.

What's even worse is that digikam remembers this information even after removing and reinserting the pictures. The only way I found to get the date updated was to temporarily rename the sqlite database.
Comment 4 bert 2009-06-23 09:35:14 UTC
Indeed the bug still exists. I ran into it on 0.10.0 just a week ago again.
I can completely confirms Daniels description. Removing and inserting a picture doesn't help. Renaming the directory from the command line didn't help either.
Only way I found is to regenerate the database.


When running into this bug last week I couldn't find back this bug entry and created a new one: 196515 That one can be closed as it is a clear dub and this entry has now become active.

Note: this is clearly a bug that should be solved internally so that we can use exiftime and friends to adjust the time/date of different batches of photos. But in the long run it would be nice to have this incorporated in digikam. (i.e. specify two sets of pictures, check their exif-timestamp difference and adjust one of the sets accoridingly.)

Bert
Comment 5 bert 2009-06-23 09:36:00 UTC
*** Bug 196515 has been marked as a duplicate of this bug. ***
Comment 6 caulier.gilles 2009-07-20 11:08:09 UTC
Please, let's me hear if current implementation of digiKam from svn trunk
(1.0.0-beta3) fix your original problem with date management.

Gilles Caulier
Comment 7 Daniel Laidig 2009-07-24 18:08:55 UTC
I just found the time to compile digikam from trunk, however, for some reasons it fails to read the metadata and is just using the mtime or so in the Properties tab. All entries in the Metadata tab are displayed in gray.

Here is the relevant CMake output:
-- Check Kexiv2 library in local sub-folder...                                                                       
-- Check Kexiv2 library using pkg-config...                                                                          
-- WARNING: you are using the obsolete 'PKGCONFIG' macro use FindPkgConfig                                           
-- Found libkexiv2 release >= 0.2.0                                                                                  
-- Found libkexiv2: /usr/lib/libkexiv2.so
[...]
-- ----------------------------------------------------------------------------------                                
--  digiKam 1.0.0-beta4 dependencies results   <http://www.digikam.org>                                              
--                                                                                                                   
--  Qt4 SQL module found................ YES                                                                         
--  libjpeg library found............... YES                                                                         
--  libtiff library found............... YES                                                                         
--  libpng library found................ YES                                                                         
--  libjasper library found............. YES                                                                         
--  liblcms library found............... YES                                                                         
--  libkipi library found............... YES                                                                         
--  libkexiv2 library found............. YES                                                                         
--  libkdcraw library found............. YES                                                                         
--  libgphoto2 library found............ YES                                                                         
--  libkdepimlibs library found......... YES (optional)                                                              
--  libmarblewidget library found....... YES (optional)                                                              
--  liblensfun library found............ YES (optional)                                                              
--  libglib2 library found.............. YES (optional)                                                              
--  liblqr-1 library found.............. NO  (optional)                                                              
--  digiKam will be compiled............ YES                                                                         
-- ----------------------------------------------------------------------------------

I can see entries like this in the debug output:
digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot get metadata tag title using Exiv2   (Error # 6 :  Invalid key `Make'                                                                                     
digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot get metadata tag title using Exiv2   (Error # 6 :  Invalid key `Model'                                                                                    
digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot get metadata tag title using Exiv2   (Error # 6 :  Invalid key `DateTime'                                                                                 
digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot get metadata tag title using Exiv2   (Error # 6 :  Invalid key `ImageDescription'                                                                         
digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot get metadata tag title using Exiv2   (Error # 6 :  Invalid key `Copyright'

Can you give me a pointer what to fix in my build to make reading metadata work? Otherwise I'll have to wait until I get distribution packages to test if the bug is fixed for me.

Thanks!
Comment 8 caulier.gilles 2009-07-24 19:35:38 UTC
Very strange

Perhaps a problem with current Exiv2. do you use Exiv2 code from trunk ? And citch libkexiv2 you use. Please go to Help components Info and copy & paste contents

Gilles Caulier
Comment 9 Daniel Laidig 2009-07-24 19:48:02 UTC
I'm using distro packages (Arch) for those, but I'll build kdegraphics from trunk later and see if that helps.

digiKam version 1.0.0-beta4 (rev.: 1001949)
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Pgf: No
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 supports XMP metadata: Yes
LibCImg: 130
LibExiv2: 0.18
LibJPEG: 70
LibJasper: 1.900.1
LibKDE: 4.3.61 (KDE 4.3.61 (KDE 4.4 >= 20090717))
LibKExiv2: 0.6.0
LibKdcraw: 0.5.0
LibLCMS: 118
LibPGF: 6.09.24
LibPNG: 1.2.37
LibQt: 4.5.1
LibRaw: 0.7.2
LibTIFF: LIBTIFF, Version 3.8.2 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
Marble widget: 0.9 SVN
Parallelized demosaicing: Yes
LibGphoto2: 2.4.6
LibKipi: 0.4.0
Comment 10 caulier.gilles 2009-07-24 20:03:58 UTC
Can you identify which image give this messages. Sound like something is broken somewhere, perhaps in libkexiv2 of digiKam. I must reproduce the problem.

Also, said me what you do exactly in digiKam to see this messages

Gilles
Comment 11 caulier.gilles 2009-07-24 20:06:04 UTC
After reflexion, you use an old Exiv2, not libkexiv2 from trunk...So the problem is in digiKam DMetadata, i think...

http://lxr.kde.org/source/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp

Gilles Caulier
Comment 12 Daniel Laidig 2009-07-24 22:14:36 UTC
I tried this again using libkexiv2 from trunk, however I still get the same message. (Lots of these messages appear every time I select some image in my collection.)

So apparently something in my KDE development setup is borked... :/
Comment 13 caulier.gilles 2009-07-24 22:25:22 UTC
No, your system is safe.

I remember to see these message in my office computer today, but time have missing to investigate.

Here, at home i cannot reproduce the problem.

Can you make a test: rename you digikam4.db file to *.old and restart digiKam from scratch. Just to see if messages appear at scanning start-up...

Gilles Caulier
Comment 14 Daniel Laidig 2009-07-24 22:51:16 UTC
Very interesting. I get some of those messages on startup and the Metadata tab in the sidebar is still completely disabled. (Also after completely wiping out all digikam settings.) However, I just noticed that the "Photograph properties" section actually displays the metadata (including stuff like exposure and the timestamps I manipulated).

I also noticed  that these kDebug messages only appear when selecting images with the metadata tab open. Otherwise, digikam is quiet. :)

This also means that I could test if the bug still exists. I shifted the timestamp of some images, however, digikam wouldn't update them using "Tools -> Synchronize All Images with Database". So the bug still seems to be there.

Again, only deleting digikam4.db worked to get the new time into digikam.
Comment 15 Andreas Huggel 2009-07-25 08:23:12 UTC
> digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot
> get metadata tag title using Exiv2   (Error # 6 :  Invalid key `Make'           
> digikam(15121)/KEXIV2 KExiv2Iface::KExiv2Priv::printExiv2ExceptionError: Cannot
> get metadata tag title using Exiv2   (Error # 6 :  Invalid key `Model'          

The correct Exiv2 keys should be of the form `Exif.Image.Make', etc.

-ahu.
Comment 16 caulier.gilles 2009-07-25 10:06:47 UTC
Andreas,

Yes, i have changed recently a lot of code in metadata viewer. i certainly do a mistake somewhere (:=))). I will fix it...

Gilles
Comment 17 caulier.gilles 2009-07-25 11:24:10 UTC
Daniel,

The bug have been introduced with my new code to handle metadata tags filter. To wrap around, see below :

Go to Setup dialog, Metadata panel
Select Exif and press Default button
Do the same with Makernote, Iptc, and Xmp
Press Ok.

It must fix the problem...

Gilles Caulier
Comment 18 Daniel Laidig 2009-07-25 11:35:21 UTC
Yeah, that fixes the problem of the metadata tab. :)

However, he creation date still isn't updated.
Comment 19 caulier.gilles 2009-07-25 11:37:49 UTC
For creation date, problem is in another place... certainly in code used to parsed image metadata with item is imported... Marcel ?

Gilles
Comment 20 Marcel Wiesweg 2009-07-25 14:45:26 UTC
Exiftime does not compile for me, but I tried this by entering a wrong creation date into the database for an image.
I then called Right Sidebar -> More -> Read metadata from file to database, and the creation date is updated. The relevant code was changed one or two weeks ago.
Which testcase does not work for you?
Comment 21 Daniel Laidig 2009-07-25 15:02:12 UTC
After spending minutes searching for that option (I was about to grep in the sources...) I finally found the option you mentioned in the "Caption/Tags" tab. WTF ist this button doing there?

At least I found out that this indeed updates the creation date. :)

What I tried to use is "Tools -> Synchronize All Images with Database", which does not work.
Comment 22 Marcel Wiesweg 2009-07-25 16:56:08 UTC
That is indeed a problem. "Tools -> Synchronize All Images with Database" writes the metadata from that database to the file.

Gilles, I think we need to
1) Give the batch action a more precise name
2) Provide a batch action for the "read from file to database" vice-versa action
?
Comment 23 Daniel Laidig 2009-07-25 17:06:48 UTC
This is indeed confusing, especially as the warning "Updating the metadata database can take some time." indicates that the database is updated and not the images.

Also, at least the timestamp isn't written back when using this tool.
Comment 24 bert 2009-07-25 17:54:21 UTC
Guys,

I've been following this thread for  the past few days. I'm happy to
see this much activity.
I am fully alligned with Daniel, with respect to the usecase. I also
fell for the deceptive "Synchronize All Images with Database"

On some level it is amusing that we were fooled on 3 levels:
1) the unclear description of the action
2) the warning, which indicated that the metadata would be updated
3) the result, where the images were not updated...

I checked for the Read metadata from file to database. Took me a while
to find it. It was indeed cleverly hidden. But I'm impressed the
function is already there.  I agree that Marcels proposal is the way
forward. Alternatively the two can be merged in the tool menu, as
"Synchronize Image tags with database" (to keep the number of items in
the menu down)
Then a popup where you can specify
-write database info to image tag
-write image tag info to database

Unfortunately, I'm still on  digikam 2:0.10.0-1ubuntu. But I look
forward to testing the result when ubuntu puts out a newer version.
Will it be feasible to add a batch function to move the timestamp of a
batch of images foreward or backward (so we don't need exiftime
anymore)

Regards,

Bert
Comment 25 Marcel Wiesweg 2009-07-25 19:09:27 UTC
> Will it be feasible to add a batch function to move the timestamp of a
> batch of images foreward or backward (so we don't need exiftime
> anymore)

Doesn't the "Adjust Date & Time" kipi plugin do the job for you?
Comment 26 Marcel Wiesweg 2009-07-25 22:21:45 UTC
SVN commit 1002380 by mwiesweg:

Support both syncing directions in BatchSyncMetadata tool

CCBUG: 147885

 M  +24 -7     batchsyncmetadata.cpp  
 M  +8 -2      batchsyncmetadata.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1002380
Comment 27 Marcel Wiesweg 2009-07-25 22:21:56 UTC
SVN commit 1002381 by mwiesweg:

Add distinct actions "Write Metadata to Images" and "Reread Metadata From Images",
a pair each for the Album (updates whole album) and Image (updates selected images) menu.

BUG: 147885

 M  +3 -1      NEWS  
 M  +50 -4     digikam/digikamapp.cpp  
 M  +8 -2      digikam/digikamapp_p.h  
 M  +6 -2      digikam/digikamui.rc  
 M  +38 -11    digikam/digikamview.cpp  
 M  +6 -2      digikam/digikamview.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1002381
Comment 28 Daniel Laidig 2009-07-25 22:41:53 UTC
Yay, thanks! :)

Just tested it. "Album -> Reread Metadata from Images" works like a charm, but "Tools -> Synchronize All Images with Database" didn't do anything different for me and is still confusing.
Comment 29 Marcel Wiesweg 2009-07-26 16:03:47 UTC
SVN commit 1002590 by mwiesweg:

Adjust action description and warning message for write-metadata-of-all batch action.

CCBUG: 147885

 M  +7 -6      digikamapp.cpp  
 M  +1 -1      digikamapp.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1002590
Comment 30 bert 2009-07-28 21:13:29 UTC
>> Will it be feasible to add a batch function to move the timestamp of a
>> batch of images foreward or backward (so we don't need exiftime
>> anymore)
>
> Doesn't the "Adjust Date & Time" kipi plugin do the job for you?
>
It does... My bad. When was this added? I admit I last looked when
this bug was filed, on the 0.9 something series of digikam.
But it works great work. Thanks.