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



commit a57fa06414ac830c95a2562a13414f86dcea0870
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Oct 18 12:21:41 2011 +0200

    tracker-extract, gif: Ignore images in certain directories

 src/tracker-extract/tracker-extract-gif.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index ec6ed47..0d474ff 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -34,9 +34,12 @@
 #include <gif_lib.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 XMP_MAGIC_TRAILER_LENGTH 256
 #define EXTENSION_RECORD_COMMENT_BLOCK_CODE 0xFE
 
@@ -542,6 +545,12 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	tracker_xmp_free (xd);
 }
 
+static gint
+path_is_in_path (gconstpointer a,
+                 gconstpointer b)
+{
+	return tracker_path_is_in_path (b, a) ? 0 : 1;
+}
 
 static void
 extract_gif (const gchar          *uri,
@@ -561,6 +570,13 @@ extract_gif (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;
+	}
+
 	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]