[Digikam-devel] extragear/graphics/digikam/utilities/batch

Andi Clemens andi.clemens at gmx.net
Sat Jun 13 13:37:55 BST 2009


SVN commit 981366 by aclemens:

Don't scan thumbs that are already created.
This works quite fine, but it is not an optimal solution. We should add
a method that returns all valid thumb paths from the db and use it here
instead of checking every thumb path with its own query.

Marcel,
what do you think?

Andi

CCMAIL:digikam-devel at kde.org

 M  +24 -1     batchthumbsgenerator.cpp  


--- trunk/extragear/graphics/digikam/utilities/batch/batchthumbsgenerator.cpp #981365:981366
@@ -52,6 +52,9 @@
 #include "databaseaccess.h"
 #include "thumbnailloadthread.h"
 #include "thumbnailsize.h"
+#include "thumbnaildatabaseaccess.h"
+#include "thumbnaildb.h"
+#include "config-digikam.h"
 
 namespace Digikam
 {
@@ -105,16 +108,36 @@
 void BatchThumbsGenerator::slotRebuildThumbs()
 {
     setTitle(i18n("Processing..."));
-    AlbumList palbumList  = AlbumManager::instance()->allPAlbums();
 
     // Get all digiKam albums collection pictures path.
 
+    AlbumList palbumList  = AlbumManager::instance()->allPAlbums();
+
     for (AlbumList::Iterator it = palbumList.begin();
          !d->cancel && (it != palbumList.end()); ++it )
     {
         d->allPicturesPath += DatabaseAccess().db()->getItemURLsInAlbum((*it)->id());
     }
 
+#ifdef USE_THUMBS_DB
+
+    if (!d->rebuildAll)
+    {
+        for (QStringList::iterator it = d->allPicturesPath.begin(); it != d->allPicturesPath.end();)
+        {
+            if (ThumbnailDatabaseAccess().db()->findByFilePath(*it).id != -1)
+            {
+                it = d->allPicturesPath.erase(it);
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+#endif
+
     setMaximum(d->allPicturesPath.count());
 
     if(d->allPicturesPath.isEmpty())



More information about the Digikam-devel mailing list