[tracker/wip/extract-graphs: 3/11] tracker-extract: Pass a TrackerExtractInfo to the exported extract function



commit d5833cb59c28bcb4684c34708c386906f0bfd00f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 25 16:13:12 2011 +0200

    tracker-extract: Pass a TrackerExtractInfo to the exported extract function
    
    This struct replaces all previous arguments, with the advantage that it can
    be extended at any time, containing all necessary information for modules
    to to their work correctly.
    
    All modules have been changed to deal with the new function signature.

 src/libtracker-extract/tracker-data.h              |    7 +---
 src/libtracker-extract/tracker-module-manager.h    |    7 +---
 src/tracker-extract/tracker-extract-abw.c          |   14 +++++----
 src/tracker-extract/tracker-extract-epub.c         |   18 ++++++++-----
 src/tracker-extract/tracker-extract-flac.c         |   19 ++++++++-----
 src/tracker-extract/tracker-extract-gif.c          |   24 ++++++++++++-----
 src/tracker-extract/tracker-extract-gstreamer.c    |   20 ++++++++++---
 src/tracker-extract/tracker-extract-gupnp-dlna.c   |   18 +++++++++---
 src/tracker-extract/tracker-extract-html.c         |   15 +++++-----
 src/tracker-extract/tracker-extract-icon.c         |   15 +++++++---
 src/tracker-extract/tracker-extract-jpeg.c         |   25 ++++++++++++-----
 src/tracker-extract/tracker-extract-libxine.c      |   15 +++++-----
 src/tracker-extract/tracker-extract-mp3.c          |   18 ++++++++-----
 src/tracker-extract/tracker-extract-mplayer.c      |   19 +++++++------
 src/tracker-extract/tracker-extract-msoffice-xml.c |   14 ++++++---
 src/tracker-extract/tracker-extract-msoffice.c     |   19 +++++++++----
 src/tracker-extract/tracker-extract-oasis.c        |   18 +++++++++---
 src/tracker-extract/tracker-extract-pdf.c          |   28 +++++++++++++++----
 src/tracker-extract/tracker-extract-playlist.c     |   15 +++++-----
 src/tracker-extract/tracker-extract-png.c          |   23 +++++++++++-----
 src/tracker-extract/tracker-extract-ps.c           |   20 ++++++++++---
 src/tracker-extract/tracker-extract-text.c         |   24 ++++++++---------
 src/tracker-extract/tracker-extract-tiff.c         |   25 ++++++++++++-----
 src/tracker-extract/tracker-extract-totem.c        |   14 +++++----
 src/tracker-extract/tracker-extract-vorbis.c       |   14 +++++----
 src/tracker-extract/tracker-extract-xmp.c          |   24 ++++++++++++-----
 src/tracker-extract/tracker-extract.c              |   15 +++-------
 27 files changed, 307 insertions(+), 180 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-data.h b/src/libtracker-extract/tracker-data.h
index 1a7a57d..6dbe9c1 100644
--- a/src/libtracker-extract/tracker-data.h
+++ b/src/libtracker-extract/tracker-data.h
@@ -26,6 +26,7 @@
 
 #include <libtracker-sparql/tracker-sparql.h>
 #include "tracker-module-manager.h"
+#include "tracker-extract-info.h"
 
 G_BEGIN_DECLS
 
@@ -139,11 +140,7 @@ gboolean tracker_extract_module_shutdown (void);
  *
  * Since: 0.12
  */
-gboolean tracker_extract_get_metadata (const gchar          *uri,
-                                       const gchar          *mimetype,
-                                       TrackerSparqlBuilder *preupdate,
-                                       TrackerSparqlBuilder *metadata,
-                                       GString              *where);
+gboolean tracker_extract_get_metadata (TrackerExtractInfo *info);
 
 G_END_DECLS
 
diff --git a/src/libtracker-extract/tracker-module-manager.h b/src/libtracker-extract/tracker-module-manager.h
index bc44411..01d76bb 100644
--- a/src/libtracker-extract/tracker-module-manager.h
+++ b/src/libtracker-extract/tracker-module-manager.h
@@ -28,6 +28,7 @@
 #include <gmodule.h>
 
 #include <libtracker-sparql/tracker-sparql.h>
+#include "tracker-extract-info.h"
 
 G_BEGIN_DECLS
 
@@ -44,11 +45,7 @@ typedef gboolean (* TrackerExtractInitFunc)     (TrackerModuleThreadAwareness  *
                                                  GError                       **error);
 typedef void     (* TrackerExtractShutdownFunc) (void);
 
-typedef gboolean (* TrackerExtractMetadataFunc) (const gchar          *uri,
-                                                 const gchar          *mime_type,
-                                                 TrackerSparqlBuilder *preupdate,
-                                                 TrackerSparqlBuilder *metadata,
-                                                 GString              *where);
+typedef gboolean (* TrackerExtractMetadataFunc) (TrackerExtractInfo *info);
 
 
 gboolean  tracker_extract_module_manager_init                (void) G_GNUC_CONST;
diff --git a/src/tracker-extract/tracker-extract-abw.c b/src/tracker-extract/tracker-extract-abw.c
index c908cee..ac8d0b4 100644
--- a/src/tracker-extract/tracker-extract-abw.c
+++ b/src/tracker-extract/tracker-extract-abw.c
@@ -162,19 +162,21 @@ static GMarkupParser parser = {
 };
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *preupdate, *metadata;
 	GMappedFile *file;
 	gchar *filename, *contents;
 	GError *error = NULL;
 	gboolean retval = FALSE;
+	GFile *f;
 	gsize len;
 
-	filename = g_filename_from_uri (uri, NULL, &error);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
+	f = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (f);
 
 	if (error) {
 		g_warning ("Could not get filename: %s\n", error->message);
diff --git a/src/tracker-extract/tracker-extract-epub.c b/src/tracker-extract/tracker-extract-epub.c
index 1ba7a8b..3c2f397 100644
--- a/src/tracker-extract/tracker-extract-epub.c
+++ b/src/tracker-extract/tracker-extract-epub.c
@@ -352,22 +352,26 @@ extract_opf (const gchar          *uri,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mime_used,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
-	gchar *opf_path;
+	gchar *opf_path, *uri;
+	GFile *file;
+
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
 
 	opf_path = extract_opf_path (uri);
 
 	if (!opf_path) {
+		g_free (uri);
 		return FALSE;
 	}
 
-	extract_opf (uri, opf_path, preupdate, metadata);
+	extract_opf (uri, opf_path,
+	             tracker_extract_info_get_preupdate_builder (info),
+	             tracker_extract_info_get_metadata_builder (info));
 	g_free (opf_path);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index 3ec9d8d..ae2c67a 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -151,21 +151,23 @@ add_tuple (TrackerSparqlBuilder *metadata,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-			      const gchar          *mimetype,
-			      TrackerSparqlBuilder *preupdate,
-			      TrackerSparqlBuilder *metadata,
-			      GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	FLAC__Metadata_SimpleIterator *iter;
 	FLAC__StreamMetadata *stream = NULL, *vorbis, *picture;
 	FLAC__bool success;
 	FlacData fd = { 0 };
-	gchar *filename, *artist_uri = NULL, *album_uri = NULL;
+	TrackerSparqlBuilder *preupdate, *metadata;
+	gchar *filename, *uri, *artist_uri = NULL, *album_uri = NULL;
 	const gchar *creator;
+	GFile *file;
 	goffset size;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 
 	size = tracker_file_get_size (filename);
 
@@ -183,6 +185,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 		return FALSE;
 	}
 
+	uri = g_file_get_uri (file);
+
 	do {
 		switch (FLAC__metadata_simple_iterator_get_block_type (iter)) {
 		case FLAC__METADATA_TYPE_STREAMINFO:
@@ -430,6 +434,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	g_free (fd.organisation);
 	g_free (fd.location);
 	g_free (fd.publisher);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index 7314c38..08afe73 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -515,17 +515,20 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *preupdate, *metadata;
 	goffset size;
 	GifFileType *gifFile = NULL;
-	gchar *filename;
+	GString *where;
+	gchar *filename, *uri;
+	GFile *file;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 	size = tracker_file_get_size (filename);
 
 	if (size < 64) {
@@ -544,7 +547,14 @@ tracker_extract_get_metadata (const gchar          *uri,
 	tracker_sparql_builder_object (metadata, "nfo:Image");
 	tracker_sparql_builder_object (metadata, "nmm:Photo");
 
+	where = g_string_new ("");
+	uri = g_file_get_uri (file);
+
 	read_metadata (preupdate, metadata, where, gifFile, uri);
+	tracker_extract_info_set_where_clause (info,
+	                                       g_string_free (where, FALSE));
+
+	g_free (uri);
 
 	if (DGifCloseFile (gifFile) != GIF_OK) {
 		PrintGifError ();
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 05472f7..0c18fa7 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1608,12 +1608,20 @@ tracker_extract_gstreamer (const gchar          *uri,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata, *preupdate;
+	const gchar *mimetype;
+	GFile *file;
+	gchar *uri;
+
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	mimetype = tracker_extract_info_get_mimetype (info);
+
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
+
 #if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
 	if (g_str_has_prefix (mimetype, "dlna/")) {
 		tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_GUESS);
@@ -1634,8 +1642,10 @@ tracker_extract_get_metadata (const gchar          *uri,
 	} else if (g_str_has_prefix (mimetype, "image/")) {
 		tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_IMAGE);
 	} else {
+		g_free (uri);
 		return FALSE;
 	}
 
+	g_free (uri);
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-gupnp-dlna.c b/src/tracker-extract/tracker-extract-gupnp-dlna.c
index b7ef72f..c4a3365 100644
--- a/src/tracker-extract/tracker-extract-gupnp-dlna.c
+++ b/src/tracker-extract/tracker-extract-gupnp-dlna.c
@@ -833,12 +833,18 @@ extract_gupnp_dlna (const gchar          *uri,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	const gchar *mimetype;
+	gchar *uri;
+
+	mimetype = tracker_extract_info_get_mimetype (info);
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
+
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
 	if (strcmp (mimetype, "video/3gpp") == 0 ||
 	    strcmp (mimetype, "video/mp4") == 0 ||
 	    strcmp (mimetype, "video/x-ms-asf") == 0 ||
@@ -851,8 +857,10 @@ tracker_extract_get_metadata (const gchar          *uri,
 	} else if (g_str_has_prefix (mimetype, "image/")) {
 		extract_gupnp_dlna (uri, preupdate, metadata, CONTENT_IMAGE);
 	} else {
+		g_free (uri);
 		return FALSE;
 	}
 
+	g_free (uri);
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-html.c b/src/tracker-extract/tracker-extract-html.c
index 6b761d6..b03a4a5 100644
--- a/src/tracker-extract/tracker-extract-html.c
+++ b/src/tracker-extract/tracker-extract-html.c
@@ -38,7 +38,6 @@ typedef enum {
 typedef struct {
 	TrackerSparqlBuilder *metadata;
 	tag_type current;
-	const gchar *uri;
 	guint in_body : 1;
 	GString *title;
 	GString *plain_text;
@@ -231,12 +230,10 @@ parser_characters (void          *data,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata;
+	GFile *file;
 	TrackerConfig *config;
 	htmlDocPtr doc;
 	parser_data pd;
@@ -276,20 +273,22 @@ tracker_extract_get_metadata (const gchar          *uri,
 		NULL  /* xmlStructuredErrorFunc */
 	};
 
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	file = tracker_extract_info_get_file (info);
+
 	tracker_sparql_builder_predicate (metadata, "a");
 	tracker_sparql_builder_object (metadata, "nfo:HtmlDocument");
 
 	pd.metadata = metadata;
 	pd.current = -1;
 	pd.in_body = FALSE;
-	pd.uri = uri;
 	pd.plain_text = g_string_new (NULL);
 	pd.title = g_string_new (NULL);
 
 	config = tracker_main_get_config ();
 	pd.n_bytes_remaining = tracker_config_get_max_bytes (config);
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	filename = g_file_get_path (file);
 	doc = htmlSAXParseFile (filename, NULL, &handler, &pd);
 	g_free (filename);
 
diff --git a/src/tracker-extract/tracker-extract-icon.c b/src/tracker-extract/tracker-extract-icon.c
index c2b3670..c24d524 100644
--- a/src/tracker-extract/tracker-extract-icon.c
+++ b/src/tracker-extract/tracker-extract-icon.c
@@ -125,14 +125,17 @@ find_max_width_and_height (const gchar *uri,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata;
 	guint max_width;
 	guint max_height;
+	GFile *file;
+	gchar *uri;
+
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
 
 	/* The Windows Icon file format may contain the same icon with different
 	 * sizes inside, so there's no clear way of setting single width and
@@ -152,5 +155,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 		}
 	}
 
+	g_free (uri);
+
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 36c7ab2..46559e3 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -140,29 +140,32 @@ guess_dlna_profile (gint          width,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	struct jpeg_decompress_struct cinfo;
 	struct tej_error_mgr tejerr;
 	struct jpeg_marker_struct *marker;
+	TrackerSparqlBuilder *preupdate, *metadata;
 	TrackerXmpData *xd = NULL;
 	TrackerExifData *ed = NULL;
 	TrackerIptcData *id = NULL;
 	MergeData md = { 0 };
+	GFile *file;
 	FILE *f;
 	goffset size;
-	gchar *filename;
+	gchar *filename, *uri;
 	gchar *comment = NULL;
 	const gchar *dlna_profile;
 	GPtrArray *keywords;
 	gboolean success = TRUE;
+	GString *where;
 	guint i;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 
 	size = tracker_file_get_size (filename);
 
@@ -178,6 +181,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 		return FALSE;
 	}
 
+	uri = g_file_get_uri (file);
+
 	tracker_sparql_builder_predicate (metadata, "a");
 	tracker_sparql_builder_object (metadata, "nfo:Image");
 	tracker_sparql_builder_predicate (metadata, "a");
@@ -416,6 +421,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 		tracker_keywords_parse (keywords, id->keywords);
 	}
 
+	where = g_string_new ("");
+
 	for (i = 0; i < keywords->len; i++) {
 		gchar *p, *escaped, *var;
 
@@ -446,6 +453,9 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 	g_ptr_array_free (keywords, TRUE);
 
+	tracker_extract_info_set_where_clause (info,
+	                                       g_string_free (where, FALSE));
+
 	if (md.make || md.model) {
 		gchar *equip_uri;
 
@@ -722,6 +732,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 
 fail:
 	tracker_file_close (f, FALSE);
+	g_free (uri);
 
 	return success;
 }
diff --git a/src/tracker-extract/tracker-extract-libxine.c b/src/tracker-extract/tracker-extract-libxine.c
index 7bd8654..3551d8e 100644
--- a/src/tracker-extract/tracker-extract-libxine.c
+++ b/src/tracker-extract/tracker-extract-libxine.c
@@ -29,11 +29,7 @@
 #include <libtracker-extract/tracker-extract.h>
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	xine_t            *xine_base;
 	xine_audio_port_t *audio_port;
@@ -56,7 +52,12 @@ tracker_extract_get_metadata (const gchar          *uri,
 	const char        *genre;
 	const char        *track;
 
-	g_return_if_fail (uri && metadata);
+	TrackerSparqlBuilder *metadata, *preupdate;
+	GFile             *file;
+
+	file = tracker_extract_info_get_file (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
 
 	xine_base = xine_new ();
 
@@ -83,7 +84,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 		return FALSE;
 	}
 
-	mrl = g_filename_from_uri (uri, NULL, NULL);
+	mrl = g_file_get_path (file);
 
 	if (!xine_open (stream, mrl)) {
 		g_free (mrl);
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index b6aa9c3..47fb6cf 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -2060,13 +2060,9 @@ parse_id3v2 (const gchar          *data,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
-	gchar *filename;
+	gchar *filename, *uri;
 	int fd;
 	void *buffer;
 	void *id3v1_buffer;
@@ -2074,8 +2070,14 @@ tracker_extract_get_metadata (const gchar          *uri,
 	goffset  buffer_size;
 	goffset audio_offset;
 	MP3Data md = { 0 };
+	TrackerSparqlBuilder *metadata, *preupdate;
+	GFile *file;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 
 	size = tracker_file_get_size (filename);
 
@@ -2152,6 +2154,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 
 	/* Get other embedded tags */
+	uri = g_file_get_uri (file);
 	audio_offset = parse_id3v2 (buffer, buffer_size, &md.id3v1, uri, metadata, &md);
 
 	md.title = tracker_coalesce_strip (4, md.id3v24.title2,
@@ -2475,6 +2478,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 #endif
 
 	g_free (filename);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-mplayer.c b/src/tracker-extract/tracker-extract-mplayer.c
index 611e2d7..aa724c5 100644
--- a/src/tracker-extract/tracker-extract-mplayer.c
+++ b/src/tracker-extract/tracker-extract-mplayer.c
@@ -69,7 +69,6 @@ static const gchar *info_tags[][2] = {
 typedef struct {
 	TrackerSparqlBuilder *preupdate;
 	TrackerSparqlBuilder *metadata;
-	const gchar *uri;
 } ForeachCopyInfo;
 
 static void
@@ -101,15 +100,17 @@ copy_hash_table_entry (gpointer key,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata, *preupdate;
+	GFile *file;
 	gchar *argv[10];
 	gchar *mplayer;
 
+	file = tracker_extract_info_get_file (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+
 	argv[0] = g_strdup ("mplayer");
 	argv[1] = g_strdup ("-identify");
 	argv[2] = g_strdup ("-frames");
@@ -118,7 +119,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	argv[5] = g_strdup ("null");
 	argv[6] = g_strdup ("-ao");
 	argv[7] = g_strdup ("null");
-	argv[8] = g_filename_from_uri (uri, NULL, NULL);
+	argv[8] = g_file_get_path (file);
 	argv[9] = NULL;
 
 	if (tracker_spawn (argv, 10, &mplayer, NULL, NULL)) {
@@ -248,7 +249,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 			tracker_sparql_builder_object (metadata, "nmm:Video");
 
 			if (tmp_metadata_video) {
-				ForeachCopyInfo info = { preupdate, metadata, uri };
+				ForeachCopyInfo info = { preupdate, metadata };
 				g_hash_table_foreach (tmp_metadata_video,
 				                      copy_hash_table_entry,
 				                      &info);
@@ -267,7 +268,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 			tracker_sparql_builder_object (metadata, "nfo:Audio");
 
 			if (tmp_metadata_audio) {
-				ForeachCopyInfo info = { preupdate, metadata, uri };
+				ForeachCopyInfo info = { preupdate, metadata };
 				g_hash_table_foreach (tmp_metadata_audio,
 				                      copy_hash_table_entry,
 				                      &info);
diff --git a/src/tracker-extract/tracker-extract-msoffice-xml.c b/src/tracker-extract/tracker-extract-msoffice-xml.c
index f43bfca..f9892f9 100644
--- a/src/tracker-extract/tracker-extract-msoffice-xml.c
+++ b/src/tracker-extract/tracker-extract-msoffice-xml.c
@@ -753,22 +753,25 @@ extract_content (MsOfficeXMLParserInfo *info)
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *extract_info)
 {
 	MsOfficeXMLParserInfo info = { 0 };
 	MsOfficeXMLFileType file_type;
+	TrackerSparqlBuilder *metadata;
 	TrackerConfig *config;
 	GMarkupParseContext *context = NULL;
 	GError *error = NULL;
+	GFile *file;
+	gchar *uri;
 
 	if (G_UNLIKELY (maximum_size_error_quark == 0)) {
 		maximum_size_error_quark = g_quark_from_static_string ("maximum_size_error");
 	}
 
+	metadata = tracker_extract_info_get_metadata_builder (extract_info);
+	file = tracker_extract_info_get_file (extract_info);
+	uri = g_file_get_uri (file);
+
 	/* Get current Content Type */
 	file_type = msoffice_xml_get_file_type (uri);
 
@@ -834,6 +837,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 
 	g_timer_destroy (info.timer);
 	g_markup_parse_context_free (context);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index 241c8e7..e28a986 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -1631,23 +1631,29 @@ extract_summary (TrackerSparqlBuilder *metadata,
  * @param metadata where to store extracted data to
  */
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mime_used,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata;
 	TrackerConfig *config;
 	GsfInfile *infile = NULL;
-	gchar *content = NULL;
+	gchar *content = NULL, *uri;
 	gboolean is_encrypted = FALSE;
+	const gchar *mime_used;
 	gsize max_bytes;
+	GFile *file;
 
 	gsf_init ();
 
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	mime_used = tracker_extract_info_get_mimetype (info);
+
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
+
 	infile = open_uri (uri);
 	if (!infile) {
 		gsf_shutdown ();
+		g_free (uri);
 		return FALSE;
 	}
 
@@ -1689,6 +1695,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 
 	g_object_unref (infile);
+	g_free (uri);
 	gsf_shutdown ();
 
 	return TRUE;
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index be28b30..2f654d0 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -157,15 +157,15 @@ extract_oasis_content (const gchar          *uri,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mime_used,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *extract_info)
 {
+	TrackerSparqlBuilder *metadata;
 	TrackerConfig *config;
 	ODTMetadataParseInfo info;
 	ODTFileType file_type;
+	GFile *file;
+	gchar *uri;
+	const gchar *mime_used;
 	GMarkupParseContext *context;
 	GMarkupParser parser = {
 		xml_start_element_handler_metadata,
@@ -179,6 +179,12 @@ tracker_extract_get_metadata (const gchar          *uri,
 		maximum_size_error_quark = g_quark_from_static_string ("maximum_size_error");
 	}
 
+	metadata = tracker_extract_info_get_metadata_builder (extract_info);
+	mime_used = tracker_extract_info_get_mimetype (extract_info);
+
+	file = tracker_extract_info_get_file (extract_info);
+	uri = g_file_get_uri (file);
+
 	/* Setup conf */
 	config = tracker_main_get_config ();
 
@@ -220,6 +226,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 	                       file_type,
 	                       metadata);
 
+	g_free (uri);
+
 	return TRUE;
 }
 
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 023a4f2..15f1364 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -265,27 +265,32 @@ write_pdf_data (PDFData               data,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	TrackerConfig *config;
 	GTime creation_date;
 	GError *error = NULL;
+	TrackerSparqlBuilder *metadata, *preupdate;
 	TrackerXmpData *xd = NULL;
 	PDFData pd = { 0 }; /* actual data */
 	PDFData md = { 0 }; /* for merging */
 	PopplerDocument *document;
 	gchar *xml = NULL;
-	gchar *content;
+	gchar *content, *uri;
 	guint n_bytes;
 	GPtrArray *keywords;
+	GString *where;
 	guint i;
+	GFile *file;
 
 	g_type_init ();
 
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
+
 	document = poppler_document_new_from_file (uri, NULL, &error);
 
 	if (error) {
@@ -297,6 +302,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 			tracker_sparql_builder_object_boolean (metadata, TRUE);
 
 			g_error_free (error);
+			g_free (uri);
+
 			return TRUE;
 		} else {
 			g_warning ("Couldn't create PopplerDocument from uri:'%s', %s",
@@ -304,6 +311,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 			           error->message ? error->message : "no error given");
 
 			g_error_free (error);
+			g_free (uri);
+
 			return FALSE;
 		}
 	}
@@ -312,6 +321,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 		g_warning ("Could not create PopplerDocument from uri:'%s', "
 		           "NULL returned without an error",
 		           uri);
+		g_free (uri);
 		return FALSE;
 	}
 
@@ -577,6 +587,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 		write_pdf_data (pd, metadata, keywords);
 	}
 
+	where = g_string_new ("");
+
 	for (i = 0; i < keywords->len; i++) {
 		gchar *p, *escaped, *var;
 
@@ -607,6 +619,9 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 	g_ptr_array_free (keywords, TRUE);
 
+	tracker_extract_info_set_where_clause (info,
+	                                       g_string_free (where, FALSE));
+
 	tracker_sparql_builder_predicate (metadata, "nfo:pageCount");
 	tracker_sparql_builder_object_int64 (metadata, poppler_document_get_n_pages (document));
 
@@ -629,6 +644,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	g_free (pd.creation_date);
 	g_free (pd.author);
 	g_free (pd.date);
+	g_free (uri);
 
 	g_object_unref (document);
 
diff --git a/src/tracker-extract/tracker-extract-playlist.c b/src/tracker-extract/tracker-extract-playlist.c
index 4bcb1b1..83db6e8 100644
--- a/src/tracker-extract/tracker-extract-playlist.c
+++ b/src/tracker-extract/tracker-extract-playlist.c
@@ -49,7 +49,6 @@ typedef struct {
 	guint32 track_counter;
 	gint64 total_time;
 	TrackerSparqlBuilder *metadata;
-	const gchar *uri;
 } PlaylistMetadata;
 
 static void
@@ -98,17 +97,18 @@ entry_parsed (TotemPlParser *parser, const gchar *to_uri, GHashTable *to_metadat
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	TotemPlParser       *pl;
 	TotemPlParserResult  result;
-	PlaylistMetadata     data = { 0, 0, metadata, uri };
+	TrackerSparqlBuilder *metadata = tracker_extract_info_get_metadata_builder (info);
+	PlaylistMetadata     data = { 0, 0, metadata };
+	GFile               *file;
+	gchar               *uri;
 
 	pl = totem_pl_parser_new ();
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
 
 	g_object_set (pl, "recurse", FALSE, "disable-unsafe", TRUE, NULL);
 
@@ -144,6 +144,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 
 	g_object_unref (pl);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index e64c9e3..fbb24ea 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -576,11 +576,7 @@ guess_dlna_profile (gint          depth,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	goffset size;
 	FILE *f;
@@ -593,11 +589,18 @@ tracker_extract_get_metadata (const gchar          *uri,
 	gint bit_depth, color_type;
 	gint interlace_type, compression_type, filter_type;
 	const gchar *dlna_profile;
-	gchar *filename;
+	TrackerSparqlBuilder *preupdate, *metadata;
+	gchar *filename, *uri;
+	GString *where;
+	GFile *file;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 	size = tracker_file_get_size (filename);
 
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
 	if (size < 64) {
 		return FALSE;
 	}
@@ -679,7 +682,13 @@ tracker_extract_get_metadata (const gchar          *uri,
 	tracker_sparql_builder_object (metadata, "nfo:Image");
 	tracker_sparql_builder_object (metadata, "nmm:Photo");
 
+	uri = g_file_get_uri (file);
+	where = g_string_new ("");
+
 	read_metadata (preupdate, metadata, where, png_ptr, info_ptr, end_ptr, uri);
+	tracker_extract_info_set_where_clause (info,
+	                                       g_string_free (where, FALSE));
+	g_free (uri);
 
 	tracker_sparql_builder_predicate (metadata, "nfo:width");
 	tracker_sparql_builder_object_int64 (metadata, width);
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index edfacb6..f86f96c 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -279,12 +279,20 @@ extract_ps_gz (const gchar          *uri,
 #endif /* USING_UNZIPPSFILES */
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *preupdate, *metadata;
+	const gchar *mimetype;
+	GFile *file;
+	gchar *uri;
+
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+	mimetype = tracker_extract_info_get_mimetype (info);
+
+	file = tracker_extract_info_get_file (info);
+	uri = g_file_get_uri (file);
+
 #ifdef USING_UNZIPPSFILES
 	if (strcmp (mimetype, "application/x-gzpostscript") == 0) {
 		extract_ps_gz (uri, preupdate, metadata);
@@ -294,5 +302,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 		extract_ps (uri, preupdate, metadata);
 	}
 
+	g_free (uri);
+
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-text.c b/src/tracker-extract/tracker-extract-text.c
index f5f312e..db61e34 100644
--- a/src/tracker-extract/tracker-extract-text.c
+++ b/src/tracker-extract/tracker-extract-text.c
@@ -32,28 +32,28 @@
 #define  TRY_LOCALE_TO_UTF8_CONVERSION 0
 
 static gchar *
-get_file_content (const gchar  *uri,
-                  gsize         n_bytes)
+get_file_content (GFile *file,
+                  gsize  n_bytes)
 {
-	GFile *file;
 	GFileInputStream  *stream;
 	GError     *error = NULL;
-	gchar      *text;
+	gchar      *text, *uri;
 
 	/* If no content requested, return */
 	if (n_bytes == 0) {
 		return NULL;
 	}
 
+	uri = g_file_get_uri (file);
+
 	/* Get filename from URI */
-	file = g_file_new_for_uri (uri);
 	stream = g_file_read (file, NULL, &error);
 	if (error) {
 		g_message ("Could not read file '%s': %s",
 		           uri,
 		           error->message);
 		g_error_free (error);
-		g_object_unref (file);
+		g_free (uri);
 
 		return NULL;
 	}
@@ -67,7 +67,7 @@ get_file_content (const gchar  *uri,
 	                                      TRY_LOCALE_TO_UTF8_CONVERSION);
 
 	g_object_unref (stream);
-	g_object_unref (file);
+	g_free (uri);
 
 	return text;
 }
@@ -81,18 +81,16 @@ tracker_extract_module_init (TrackerModuleThreadAwareness  *thread_awareness_ret
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata;
 	TrackerConfig *config;
 	gchar *content;
 
 	config = tracker_main_get_config ();
+	metadata = tracker_extract_info_get_metadata_builder (info);
 
-	content = get_file_content (uri,
+	content = get_file_content (tracker_extract_info_get_file (info),
 	                            tracker_config_get_max_bytes (config));
 
 	tracker_sparql_builder_predicate (metadata, "a");
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 516063e..77b6263 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -244,11 +244,7 @@ tag_to_string (TIFF    *image,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	TIFF *image;
 	TrackerXmpData *xd = NULL;
@@ -256,11 +252,14 @@ tracker_extract_get_metadata (const gchar          *uri,
 	TrackerExifData *ed = NULL;
 	MergeData md = { 0 };
 	TiffData td = { 0 };
-	gchar *filename;
+	gchar *filename, *uri;
 	gchar *date;
 	glong exif_offset;
 	GPtrArray *keywords;
 	guint i;
+	GFile *file;
+	TrackerSparqlBuilder *metadata, *preupdate;
+	GString *where;
 
 #ifdef HAVE_LIBIPTCDATA
 	gchar *iptc_offset;
@@ -272,7 +271,11 @@ tracker_extract_get_metadata (const gchar          *uri,
 	guint32 size;
 #endif /* HAVE_EXEMPI */
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
+
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
 
 	if ((image = TIFFOpen (filename, "r")) == NULL){
 		g_warning ("Could not open image:'%s'\n", filename);
@@ -284,6 +287,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 	tracker_sparql_builder_object (metadata, "nfo:Image");
 	tracker_sparql_builder_object (metadata, "nmm:Photo");
 
+	uri = g_file_get_uri (file);
+
 #ifdef HAVE_LIBIPTCDATA
 	if (TIFFGetField (image, 
 	                  TIFFTAG_RICHTIFFIPTC, 
@@ -562,6 +567,8 @@ tracker_extract_get_metadata (const gchar          *uri,
 		tracker_keywords_parse (keywords, id->keywords);
 	}
 
+	where = g_string_new ("");
+
 	for (i = 0; i < keywords->len; i++) {
 		gchar *p, *escaped, *var;
 
@@ -592,6 +599,9 @@ tracker_extract_get_metadata (const gchar          *uri,
 	}
 	g_ptr_array_free (keywords, TRUE);
 
+	tracker_extract_info_set_where_clause (info,
+	                                       g_string_free (where, FALSE));
+
 	if (md.make || md.model) {
 		gchar *equip_uri;
 
@@ -753,6 +763,7 @@ tracker_extract_get_metadata (const gchar          *uri,
 	tracker_exif_free (ed);
 	tracker_xmp_free (xd);
 	tracker_iptc_free (id);
+	g_free (uri);
 
 	return TRUE;
 }
diff --git a/src/tracker-extract/tracker-extract-totem.c b/src/tracker-extract/tracker-extract-totem.c
index 1bfc3d9..035c19a 100644
--- a/src/tracker-extract/tracker-extract-totem.c
+++ b/src/tracker-extract/tracker-extract-totem.c
@@ -56,19 +56,21 @@ metadata_write_foreach (gpointer key,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
 	gchar *argv[3];
 	gchar *totem;
 	gboolean has_video = FALSE;
 	GHashTable *tmp_metadata;
+	TrackerSparqlBuilder *metadata, *preupdate;
+	GFile *file;
+
+	file = tracker_extract_info_get_file (info);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
 
 	argv[0] = g_strdup ("totem-video-indexer");
-	argv[1] = g_filename_from_uri (uri, NULL, NULL);
+	argv[1] = g_file_get_path (file);
 	argv[2] = NULL;
 
 	tmp_metadata = g_hash_table_new_full (g_str_hash,
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 04f58df..1c3473a 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -86,12 +86,9 @@ ogg_get_comment (vorbis_comment *vc,
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const char           *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *preupdate, *metadata;
 	VorbisData vd = { 0 };
 	MergeData md = { 0 };
 	FILE *f;
@@ -101,11 +98,16 @@ tracker_extract_get_metadata (const char           *uri,
 	vorbis_info *vi;
 	unsigned int bitrate;
 	gint time;
+	GFile *file;
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
 	f = tracker_file_open (filename, "r", FALSE);
 	g_free (filename);
 
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
+
 	if (!f) {
 		return FALSE;
 	}
diff --git a/src/tracker-extract/tracker-extract-xmp.c b/src/tracker-extract/tracker-extract-xmp.c
index 3d749ee..b9f2746 100644
--- a/src/tracker-extract/tracker-extract-xmp.c
+++ b/src/tracker-extract/tracker-extract-xmp.c
@@ -120,24 +120,29 @@ find_orig_uri (const gchar *xmp_filename)
 }
 
 G_MODULE_EXPORT gboolean
-tracker_extract_get_metadata (const gchar          *uri,
-                              const gchar          *mimetype,
-                              TrackerSparqlBuilder *preupdate,
-                              TrackerSparqlBuilder *metadata,
-                              GString              *where)
+tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
+	TrackerSparqlBuilder *metadata, *preupdate;
 	TrackerXmpData *xd = NULL;
 	GError *error = NULL;
-	gchar *filename;
+	gchar *filename, *uri;
 	gchar *contents;
 	gsize length;
+	GFile *file;
+
+	file = tracker_extract_info_get_file (info);
+	filename = g_file_get_path (file);
+	uri = g_file_get_uri (file);
 
-	filename = g_filename_from_uri (uri, NULL, NULL);
+	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	metadata = tracker_extract_info_get_metadata_builder (info);
 
 	if (g_file_get_contents (filename, &contents, &length, &error)) {
 		gchar *original_uri;
+		GString *where;
 
 		original_uri = find_orig_uri (filename);
+		where = g_string_new ("");
 
 		/* If no orig file is found for the sidekick, we use the sidekick to
 		 * describe itself instead, falling back to uri 
@@ -148,16 +153,21 @@ tracker_extract_get_metadata (const gchar          *uri,
 
 		if (xd) {
 			tracker_xmp_apply (preupdate, metadata, where, uri, xd);
+			tracker_extract_info_set_where_clause (info,
+			                                       g_string_free (where, FALSE));
 		}
 
 		g_free (original_uri);
 		tracker_xmp_free (xd);
 		g_free (contents);
 		g_free (filename);
+		g_free (uri);
 
 		return TRUE;
 	}
 
 	g_free (filename);
+	g_free (uri);
+
 	return FALSE;
 }
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 71b1d1c..f2c3ad5 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -278,8 +278,6 @@ get_file_metadata (TrackerExtractTask  *task,
                    TrackerExtractInfo **info_out)
 {
 	TrackerExtractInfo *info;
-	TrackerSparqlBuilder *statements, *preupdate;
-	GString *where;
 	GFile *file;
 	gchar *mime_used = NULL;
 #ifdef HAVE_LIBSTREAMANALYZER
@@ -295,15 +293,11 @@ get_file_metadata (TrackerExtractTask  *task,
 	info = tracker_extract_info_new (file, task->mimetype, NULL);
 	g_object_unref (file);
 
-	preupdate = tracker_extract_info_get_preupdate_builder (info);
-	statements = tracker_extract_info_get_metadata_builder (info);
-	where = g_string_new ("");
-
 #ifdef HAVE_LIBSTREAMANALYZER
 	if (!priv->force_internal_extractors) {
 		g_debug ("  Using libstreamanalyzer...");
 
-		tracker_topanalyzer_extract (uri, statements, &content_type);
+		tracker_topanalyzer_extract (task->file, statements, &content_type);
 
 		if (tracker_sparql_builder_get_length (statements) > 0) {
 			g_free (content_type);
@@ -340,10 +334,13 @@ get_file_metadata (TrackerExtractTask  *task,
 	 */
 	if (mime_used) {
 		if (task->cur_func) {
+			TrackerSparqlBuilder *statements;
+
 			g_debug ("  Using %s...", g_module_name (task->cur_module));
 
-			(task->cur_func) (task->file, mime_used, preupdate, statements, where);
+			(task->cur_func) (info);
 
+			statements = tracker_extract_info_get_metadata_builder (info);
 			items = tracker_sparql_builder_get_length (statements);
 
 			if (items > 0) {
@@ -358,8 +355,6 @@ get_file_metadata (TrackerExtractTask  *task,
 		g_free (mime_used);
 	}
 
-	tracker_extract_info_set_where_clause (info,
-	                                       g_string_free (where, FALSE));
 	*info_out = info;
 
 	if (items == 0) {



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