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



commit 4b94562bdeff2f255715b213be2d0b507fb43fac
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Oct 18 12:22:52 2011 +0200

    tracker-extract, tiff: Ignore images in certain directories

 src/tracker-extract/tracker-extract-tiff.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index d177c3c..dba6d4f 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -35,8 +35,12 @@
 
 #include <tiffio.h>
 #include <libtracker-common/tracker-common.h>
+#include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-extract/tracker-extract.h>
 
+#include "tracker-main.h"
+#include "tracker-config.h"
+
 #define CM_TO_INCH          0.393700787
 
 typedef enum {
@@ -263,6 +267,13 @@ tag_to_string (TIFF    *image,
 	return NULL;
 }
 
+static gint
+path_is_in_path (gconstpointer a,
+                 gconstpointer b)
+{
+	return tracker_path_is_in_path (b, a) ? 0 : 1;
+}
+
 static void
 extract_tiff (const gchar          *uri,
               TrackerSparqlBuilder *preupdate,
@@ -294,6 +305,13 @@ extract_tiff (const gchar          *uri,
 
 	filename = g_filename_from_uri (uri, NULL, NULL);
 
+	if (g_slist_find_custom (tracker_config_get_ignore_images_under (
+	                            tracker_main_get_config()),
+	                         filename, path_is_in_path)) {
+		g_free (filename);
+		return;
+	}
+
 	fd = g_open (filename, O_RDONLY | O_NOATIME, 0);
 	if (fd == -1 && errno == EPERM) {
 		fd = g_open (filename, O_RDONLY, 0);



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