extragear/graphics/digikam/utilities/batch

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam/utilities/batch

Bugzilla from andi.clemens@gmx.net
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:[hidden email]

 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())
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel