Bug 92312

Summary: Wish: Automaticly create albums with name based on shooting date when downloading images from camera
Product: [Applications] digikam Reporter: lan
Component: Import-AlbumsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 0.7.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Very first version of auto-album feature
Implemented auto album feature
Hack AlbumManager::createPAlbum() to create album immidiate

Description lan 2004-10-29 13:04:20 UTC
Version:           0.7-beta1 (using KDE 3.2.1, SuSE)
Compiler:          gcc version 3.3.3 (SuSE Linux)
OS:                Linux (i686) release 2.6.5-7.111-default

It would great if digikam has an option to automaticly 
create albums with shooting date of image when I download them
from my camera. Because when I have images taken long time ago
it is hard to sort them by albums.

There is another bug with similar with:
#89364 - "Change date of album to exif date of first image"
But that wish is differ a little from mine.

If noone is intresting in implementing this feature, I can try
to do it manualy but it can take some time due to my poor knowleage 
of digikam classes.
Comment 1 lan 2004-11-02 04:08:44 UTC
As far as noone comment this wish I start to implement it myself.

I have wrote very 'alpha' version of this feature. For now it looks 
like a huge hack. It act almost the same as 'exif rotation' do. 
Except I didn't add GUI control for this. The main idea is to take 
EXIF information form just downloaded temp file and subsitute destination
for it (create new dir if needed - I know I should create PAlbum instead 
of new directory but for now it is not the main problem).

That is bad in this implementation ? It does not check for duplicate 
files and silently overwrite them, it does tell me I have duplicate 
images when I dont. This is because this is checked during scheduling 
image downloading when we have no exif information. So I have to ask
one of digikam developer to help me with right solution:
1. I should change tumbnails download by adding exif downloading too
and change schedule to automaticly create albums.
2. I should move duplicate check into thread that download images (by 
the way, can it interact with user via gui?)

Patch with my changes will be attached.

Waiting for respones,
Alexander Litvinov.
Comment 2 lan 2004-11-02 04:10:50 UTC
Created attachment 8129 [details]
Very first version of auto-album feature
Comment 3 Renchi Raju 2004-11-04 02:49:26 UTC
CVS commit by pahlibar: 


when user starts to download items from a camera, the new album dialog has 
name pre-filled with exif date for the first image in the camera.
BUG: 92312


  M +54 -2     cameraui.cpp   1.24
  M +9 -5      dirselectdialog.cpp   1.8
  M +6 -2      dirselectdialog.h   1.3



Comment 4 Renchi Raju 2004-11-04 02:54:15 UTC
well, not exactly what you asked for, but close enough. when user starts to download files from the camera, the select folder dialog pops up. If you click on a new album, then the dialog which pops up to enter the name of the folder is prefilled with the Exif Date of the first item (for eg, "2004, September, 20"). This dialog used to be empty earlier. User just has to click couple of Ok buttons and you have files being downloaded into the new created album. 

This is not a 100% automated solution, but avoids making guesses for a new album name if there exists album with same name and also avoids adding additional GUI features to the camera interface. 
Comment 5 lan 2004-11-04 06:48:40 UTC
The main idea of my request was the ability automaticly sort images when I have not downloaded them from my camera for a long time and have a lot of images with different shooting dates.

Thanks for implementing this feature, even if not 100% what I want.
Comment 6 lan 2004-11-04 08:24:34 UTC
I have made the feature I want. I have add check box to the camera download from near 'auto rotate' checkbox and if it is set find and if search failed create PAlbum and download image to this album.

I also try to set album date to the shooting date, but AlbumManager::createPAlbum() does not create album in db - it just create folder and wait for KDirWatch event to update albums. As far as I need PAlbum immidiatly I can't set shooting date easily.

Patch will be attached. It requires patch from bug #92665 "Review: utilities/cameragui/cameraui.cpp has duplicate parts of code". If needed I can make standalone patch.
Comment 7 lan 2004-11-04 08:25:51 UTC
Created attachment 8161 [details]
Implemented auto album feature

This one is working for me.
Comment 8 lan 2004-11-04 08:32:17 UTC
Created attachment 8162 [details]
Hack AlbumManager::createPAlbum() to create album immidiate

As I have described above, I can't set date of album when I create album.
That is why I hacked AlbumManager a little to make it possible.

At first, this is not patch ready for production use - I think it have memory
leak.

How it works: after directory creation in createPAlbum(), I add this directory
as PAlmub in db just after dir creation. Also I have add duplicate check in
addPAlmub() because album will be added twice : I add it just after dir
creationa and KDirWatcher used by album manager will find new dir and also it
will try to add the same PAlbum.

Memory leak is in the line 319-322 when I create KFileItem I can't free it and
this produce memory leak.

If someone know better solution for PAlbum creation, tell me please.
Comment 9 Renchi Raju 2004-11-18 03:51:12 UTC
CVS commit by pahlibar: 


BUG: 92665
BUG: 92312
* Auto-album patch applied (with modifications) to automatically create 
sub-albums in destination album based on exif date of the camera.
 - while downloading each file, the corresponding directory is "stat ed"
   to see if it exists. if not, get albummanager to create the album
   and write out to database, the date of the album
 - if any of these steps fails, the whole process bails out
* merged the two download (selected/all) into one functio
* thanks to lan at ac-sw com for original patches


  M +93 -82    cameraui.cpp   1.27
  M +8 -0      cameraui.h   1.14



Comment 10 lan 2004-11-18 06:51:19 UTC
Thanks for appling!