[tracker/tracker-0.10-nb276745: 5/7] tracker-extract, jpeg: Ignore images in certain directories



commit 0a968e20b54241a95d8983e3d799917df3632391
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Oct 18 12:22:29 2011 +0200

    tracker-extract, jpeg: Ignore images in certain directories

 src/tracker-extract/tracker-extract-jpeg.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index f97e80e..536f572 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -30,10 +30,12 @@
 #include <jpeglib.h>
 
 #include <libtracker-common/tracker-common.h>
+#include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-extract/tracker-extract.h>
 #include <libtracker-sparql/tracker-sparql.h>
 
 #include "tracker-main.h"
+#include "tracker-config.h"
 
 #define CM_TO_INCH              0.393700787
 
@@ -109,7 +111,7 @@ guess_dlna_profile (gint          width,
                     const gchar **dlna_profile,
                     const gchar **dlna_mimetype)
 {
-	gchar *profile = NULL;
+	const gchar *profile = NULL;
 
 	if (dlna_profile) {
 		*dlna_profile = NULL;
@@ -148,6 +150,13 @@ guess_dlna_profile (gint          width,
 	return FALSE;
 }
 
+static gint
+path_is_in_path (gconstpointer a,
+                 gconstpointer b)
+{
+	return tracker_path_is_in_path (b, a) ? 0 : 1;
+}
+
 static void
 extract_jpeg (const gchar          *uri,
               TrackerSparqlBuilder *preupdate,
@@ -178,6 +187,13 @@ extract_jpeg (const gchar          *uri,
 		return;
 	}
 
+	if (g_slist_find_custom (tracker_config_get_ignore_images_under (
+	                            tracker_main_get_config()),
+	                         filename, path_is_in_path)) {
+		g_free (filename);
+		return;
+	}
+
 	f = tracker_file_open (filename);
 	g_free (filename);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]