Bug 307253 - Rename images according to Exif date instead of file date [patch]
Summary: Rename images according to Exif date instead of file date [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Import-PostProcessing (show other bugs)
Version: 3.1.0
Platform: Compiled Sources Linux
: NOR normal with 20 votes (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-23 08:27 UTC by pochini
Modified: 2017-08-16 05:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Rename images according to photo (exif) date (606 bytes, patch)
2012-09-23 08:29 UTC, pochini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pochini 2012-09-23 08:27:30 UTC
Digkam has options to rename files while importing them. The problem is that the "[date]" option expands to the date/time of the file. This has the annoying side effect of making the file names all wrong for files which have been copied. Furthermore, when the camera is configured to save both raw and jpg, files have a different mtime, so the two versions of the same image end up having different names.

Reproducible: Always
Comment 1 pochini 2012-09-23 08:29:44 UTC
Created attachment 74106 [details]
Rename images according to photo (exif) date

This patch fixes the problem I reported.
Comment 2 Andi Clemens 2012-09-25 09:24:45 UTC
Patch seems to be ok, I will apply it...
Comment 3 Andi Clemens 2012-09-25 10:16:45 UTC
I'm unable to apply the patch because the import tool doesn't use the custom renaming option anymore?

The option is broken... Someone seems to have changed the tool and removed the custom renaming option... 

I will check with "git blame"....
Comment 4 Andi Clemens 2012-09-25 10:18:37 UTC
I hope these errors are not present in the current digiKam release... the import tool was not able to be used due to nullpointer exceptions, and now it doesn't seem to work correctly...
Comment 5 Andi Clemens 2012-09-25 10:21:43 UTC
If I remove the function RenameCustomizer::newName() and RenameCustomizer::renameManager(), digiKam still compiles. This can not be right. At least one of these methods must be used to get the new name for imported images.
Comment 6 caulier.gilles 2012-09-25 11:00:22 UTC
Andi, it's probably due to changes from Islam in Import tool revamp project. I CC him for info...

Gilles
Comment 7 pochini 2012-10-01 22:16:59 UTC
My patch is incomplete. It fixes only the names of the photos which have been loaded (at least their thumbnails). The name get fixed only when the icon is selected while it is visible. If I press ctrl-a, then I scroll down the list, the names of the newly exposed icons are wrong. Once a photo is assigned the right name, it stays.
When AdvancedRenameManager::addFile() is called for a file which hasn't been loaded yet datetime.toTime_t() is -1. I'm not sure how to fix this issue...
Comment 8 Andi Clemens 2012-10-04 12:14:50 UTC
Are you sure you are calling AdvancedRenameManager::addFile()? This method is private and should not be accessible.
Comment 9 pochini 2012-10-07 15:09:12 UTC
This is the backtrace:

#1  0x00000000006b97ca in Digikam::AdvancedRenameManager::addFiles (this=0x4b8bd80, files=<optimized out>) at /home/giu/apps/digikam-2.9.0/core/utilities/advancedrename/advancedrenamemanager.cpp:281
#2  0x00000000007b237f in Digikam::CameraIconView::slotUpdateDownloadNames (this=0x32eacf0, hasSelection=true) at /home/giu/apps/digikam-2.9.0/core/utilities/cameragui/views/cameraiconview.cpp:481
#3  0x00007ffff25f45f1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00000000007acfe0 in Digikam::CameraIconView::signalNewSelection (this=<optimized out>, _t1=true) at /home/giu/apps/digikam-2.9.0/build/core/utilities/cameragui/cameraiconview.moc:223
#5  0x00000000007ad509 in Digikam::CameraIconView::slotSelectionChanged (this=0x32eacf0) at /home/giu/apps/digikam-2.9.0/core/utilities/cameragui/views/cameraiconview.cpp:586
#6  0x00007ffff25f45f1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/qt4/libQtCore.so.4
#7  0x000000000078a59a in Digikam::IconView::selectItem (this=0x32eacf0, item=0x4c20590, select=<optimized out>) at /home/giu/apps/digikam-2.9.0/core/utilities/cameragui/q3support/iconview.cpp:500
#8  0x00000000007bfbec in Digikam::IconItem::setSelected (this=0x4c20590, val=true, cb=true) at /home/giu/apps/digikam-2.9.0/core/utilities/cameragui/q3support/iconitem.cpp:186
#9  0x0000000000789d10 in Digikam::IconView::slotRearrange (this=0x32eacf0) at /home/giu/apps/digikam-2.9.0/core/utilities/cameragui/q3support/iconview.cpp:827
#10 0x00007ffff25f45f1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/qt4/libQtCore.so.4
#11 0x00007ffff25f94e9 in QObject::event(QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#12 0x00007ffff14f2a74 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#13 0x00007ffff14f78f3 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007ffff32e0f46 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#15 0x00007ffff25e086c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#16 ...

I simply added in AdvancedRenameManager::addFile(const QString& filename, const QDateTime& datetime) a printf("%d %s\n", datetime.toTime_t(), filename.ascii()) which shows that datetime is -1 the first time the thumbnail are loaded and displayed. When I click on a thumbnail something updates datetime and it prints the correct value of that thumbnail.
Comment 10 Marcel Wiesweg 2012-11-16 10:10:24 UTC
Islam, is this regression fixed for the final release?
In the ImportUI, I see d->renameCustomizer being created and added to the UI. 
But the line d->view->setRenameCustomizer() is commented out => how does the 
view compute the adjusted names?

When computing the download name, starting from line 1685, the 
renameCustomizer is not asked. The source could be the downloadUrl retrieved 
from the view (I believe it was previously, but not a clean solution) but the 
renameCustomizer is not asked here as well.
Comment 11 Marcel Wiesweg 2012-12-09 12:58:04 UTC
No response from Islam.
Andi, can you give some guidance what would be the right lines of code to retrieve a name from the RenameCustomizer?
Comment 12 caulier.gilles 2013-01-05 22:30:23 UTC
Andi,

This file can be considerated as fixed since you close bug #312433 ?

Gilles Caulier
Comment 13 Andi Clemens 2013-01-05 23:37:31 UTC
No I don't think so, the custom names are still not working. I had not yet the time to look into this, so it definitely isn't fixed at the moment.
Comment 14 caulier.gilles 2015-01-25 11:43:07 UTC
Git commit 7f3459d55dd453f257ece35398175bba22ea4109 by Gilles Caulier.
Committed on 25/01/2015 at 11:39.
Pushed by cgilles into branch 'master'.

Apply patch #90637 from Maik Qualmann to fix image renaming settings rules in Import Tool to work properly while downloading.
Related: bug 342996, bug 314441, bug 329438, bug 342430
FIXED-IN: 4.7.0

M  +3    -1    NEWS
M  +2    -2    utilities/importui/backend/cameracontroller.cpp
M  +67   -44   utilities/importui/main/importui.cpp
M  +1    -0    utilities/importui/main/importui.h
M  +5    -0    utilities/importui/views/importview.cpp
M  +1    -0    utilities/importui/views/importview.h

http://commits.kde.org/digikam/7f3459d55dd453f257ece35398175bba22ea4109
Comment 15 caulier.gilles 2015-01-25 14:01:06 UTC
Git commit 0201e6fc8549ac849029daf36eaeadd6ebb4d4ae by Gilles Caulier.
Committed on 25/01/2015 at 13:58.
Pushed by cgilles into branch 'frameworks'.

Backport commit #7f3459d55dd453f257ece35398175bba22ea4109 from git/master to frameworks branch.
Related: bug 342996, bug 314441, bug 329438, bug 342430

M  +3    -3    utilities/importui/backend/cameracontroller.cpp
M  +74   -50   utilities/importui/main/importui.cpp
M  +1    -0    utilities/importui/main/importui.h
M  +5    -0    utilities/importui/views/importview.cpp
M  +1    -0    utilities/importui/views/importview.h

http://commits.kde.org/digikam/0201e6fc8549ac849029daf36eaeadd6ebb4d4ae