tracker r2733 - in trunk: . src/tracker-extract



Author: carlosg
Date: Thu Dec 18 16:47:01 2008
New Revision: 2733
URL: http://svn.gnome.org/viewvc/tracker?rev=2733&view=rev

Log:
2008-12-18  Carlos Garnacho  <carlos imendio com>

        * src/tracker-extract/tracker-escape.[ch]: New methods to escape
        metadata properly, so we don't barf on new lines, metadata separators,
        etc...
        * src/tracker-extract/Makefile.am: Add new files.
        * src/tracker-extract/tracker-extract.h: Include header for modules.
        * src/tracker-extract/tracker-extract-*.c:
        * src/tracker-extract/tracker-xmp.c: Escape metadata properly in the
        right places.

Added:
   trunk/src/tracker-extract/tracker-escape.c
   trunk/src/tracker-extract/tracker-escape.h
      - copied, changed from r2732, /trunk/src/tracker-extract/tracker-extract-xmp.c
Modified:
   trunk/ChangeLog
   trunk/src/tracker-extract/Makefile.am
   trunk/src/tracker-extract/tracker-extract-abw.c
   trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c
   trunk/src/tracker-extract/tracker-extract-gstreamer.c
   trunk/src/tracker-extract/tracker-extract-html.c
   trunk/src/tracker-extract/tracker-extract-jpeg.c
   trunk/src/tracker-extract/tracker-extract-libxine.c
   trunk/src/tracker-extract/tracker-extract-mp3.c
   trunk/src/tracker-extract/tracker-extract-mplayer.c
   trunk/src/tracker-extract/tracker-extract-msoffice.c
   trunk/src/tracker-extract/tracker-extract-oasis.c
   trunk/src/tracker-extract/tracker-extract-pdf.c
   trunk/src/tracker-extract/tracker-extract-playlist.c
   trunk/src/tracker-extract/tracker-extract-png.c
   trunk/src/tracker-extract/tracker-extract-ps.c
   trunk/src/tracker-extract/tracker-extract-tiff.c
   trunk/src/tracker-extract/tracker-extract-totem.c
   trunk/src/tracker-extract/tracker-extract-xmp.c
   trunk/src/tracker-extract/tracker-extract.c
   trunk/src/tracker-extract/tracker-extract.h
   trunk/src/tracker-extract/tracker-xmp.c

Modified: trunk/src/tracker-extract/Makefile.am
==============================================================================
--- trunk/src/tracker-extract/Makefile.am	(original)
+++ trunk/src/tracker-extract/Makefile.am	Thu Dec 18 16:47:01 2008
@@ -100,8 +100,12 @@
 	$(GDKPIXBUF_LIBS) $(DBUS_LIBS)
 endif
 
+escape_sources = 							\
+	tracker-escape.c						\
+	tracker-escape.h
+
 # ABW
-libextract_abw_la_SOURCES = tracker-extract-abw.c
+libextract_abw_la_SOURCES = tracker-extract-abw.c $(escape_sources)
 libextract_abw_la_LDFLAGS = $(module_flags)
 libextract_abw_la_LIBADD = $(GLIB2_LIBS)
 
@@ -111,84 +115,84 @@
 # libextract_imagemagick_la_LIBADD = $(GLIB2_LIBS) $(EXEMPI_LIBS)
 
 # MP3
-libextract_mp3_la_SOURCES = tracker-extract-mp3.c $(albumart_sources)
+libextract_mp3_la_SOURCES = tracker-extract-mp3.c $(albumart_sources) $(escape_sources)
 libextract_mp3_la_LDFLAGS = $(module_flags) $(albumart_flags)
 libextract_mp3_la_LIBADD = $(albumart_libs) $(GLIB2_LIBS)
 
 # MPlayer
-libextract_mplayer_la_SOURCES = tracker-extract-mplayer.c
+libextract_mplayer_la_SOURCES = tracker-extract-mplayer.c $(escape_sources)
 libextract_mplayer_la_LDFLAGS = $(module_flags)
 libextract_mplayer_la_LIBADD = $(GLIB2_LIBS)
 
 # Oasis
-libextract_oasis_la_SOURCES = tracker-extract-oasis.c
+libextract_oasis_la_SOURCES = tracker-extract-oasis.c $(escape_sources)
 libextract_oasis_la_LDFLAGS = $(module_flags)
 libextract_oasis_la_LIBADD = $(GLIB2_LIBS)
 
 # PNG
-libextract_png_la_SOURCES = tracker-extract-png.c $(xmp_sources)
+libextract_png_la_SOURCES = tracker-extract-png.c $(xmp_sources) $(escape_sources)
 libextract_png_la_LDFLAGS = $(module_flags)
 libextract_png_la_LIBADD = $(GLIB2_LIBS) $(LIBPNG_LIBS) $(EXEMPI_LIBS)
 
 # PS
-libextract_ps_la_SOURCES = tracker-extract-ps.c
+libextract_ps_la_SOURCES = tracker-extract-ps.c $(escape_sources)
 libextract_ps_la_LDFLAGS = $(module_flags)
 libextract_ps_la_LIBADD = 						\
 	$(top_builddir)/src/libtracker-common/libtracker-common.la	\
 	$(GLIB2_LIBS)
 
 # Totem
-libextract_totem_la_SOURCES = tracker-extract-totem.c
+libextract_totem_la_SOURCES = tracker-extract-totem.c $(escape_sources)
 libextract_totem_la_LDFLAGS = $(module_flags)
 libextract_totem_la_LIBADD = $(GLIB2_LIBS)
 
 # XMP
-libextract_xmp_la_SOURCES = tracker-extract-xmp.c $(xmp_sources)
+libextract_xmp_la_SOURCES = tracker-extract-xmp.c $(xmp_sources) $(escape_sources)
 libextract_xmp_la_LDFLAGS = $(module_flags)
 libextract_xmp_la_LIBADD = $(GLIB2_LIBS) $(EXEMPI_LIBS)
 
 # HTML
-libextract_html_la_SOURCES = tracker-extract-html.c
+libextract_html_la_SOURCES = tracker-extract-html.c $(escape_sources)
 libextract_html_la_LDFLAGS = $(module_flags)
 libextract_html_la_LIBADD = $(GLIB2_LIBS) $(LIBXML2_LIBS)
 
 # MS Office
-libextract_msoffice_la_SOURCES = tracker-extract-msoffice.c
+libextract_msoffice_la_SOURCES = tracker-extract-msoffice.c $(escape_sources)
 libextract_msoffice_la_LDFLAGS = $(module_flags)
 libextract_msoffice_la_LIBADD = $(GLIB2_LIBS) $(LIBGSF_LIBS)
 
 # PDF
-libextract_pdf_la_SOURCES = tracker-extract-pdf.c $(xmp_sources)
+libextract_pdf_la_SOURCES = tracker-extract-pdf.c $(xmp_sources) $(escape_sources)
 libextract_pdf_la_LDFLAGS = $(module_flags)
 libextract_pdf_la_LIBADD = $(GLIB2_LIBS) $(POPPLER_GLIB_LIBS) $(EXEMPI_LIBS)
 
 # GStreamer
-libextract_gstreamer_la_SOURCES = tracker-extract-gstreamer.c $(albumart_sources)
+libextract_gstreamer_la_SOURCES = tracker-extract-gstreamer.c $(albumart_sources) $(escape_sources)
 libextract_gstreamer_la_LDFLAGS = $(module_flags) $(albumart_flags)
 libextract_gstreamer_la_LIBADD = $(albumart_libs) $(GSTREAMER_LIBS) $(GLIB2_LIBS)
 
 # GStreamer helix
-libextract_gstreamer_helix_la_SOURCES = tracker-extract-gstreamer-helix.c $(albumart_sources)
+libextract_gstreamer_helix_la_SOURCES = tracker-extract-gstreamer-helix.c $(albumart_sources) $(escape_sources)
 libextract_gstreamer_helix_la_LDFLAGS = $(module_flags) $(albumart_flags)
 libextract_gstreamer_helix_la_LIBADD = $(albumart_libs) $(GSTREAMER_LIBS) $(GLIB2_LIBS)
 
 # Xine
-libextract_xine_la_SOURCES = tracker-extract-libxine.c
+libextract_xine_la_SOURCES = tracker-extract-libxine.c $(escape_sources)
 libextract_xine_la_LDFLAGS = $(module_flags)
 libextract_xine_la_LIBADD = $(GLIB2_LIBS) $(XINE_LIBS)
 
 # JPEG
-libextract_jpeg_la_SOURCES = tracker-extract-jpeg.c $(xmp_sources)
+libextract_jpeg_la_SOURCES = tracker-extract-jpeg.c $(xmp_sources) $(escape_sources)
 libextract_jpeg_la_LDFLAGS = $(module_flags)
 libextract_jpeg_la_LIBADD = $(GLIB2_LIBS) $(LIBJPEG_LIBS) $(LIBEXIF_LIBS) $(EXEMPI_LIBS)
 
 # TIFF
-libextract_tiff_la_SOURCES = tracker-extract-tiff.c $(xmp_sources)
+libextract_tiff_la_SOURCES = tracker-extract-tiff.c $(xmp_sources) $(escape_sources)
 libextract_tiff_la_LDFLAGS = $(module_flags)
 libextract_tiff_la_LIBADD = $(GLIB2_LIBS) $(LIBTIFF_LIBS) $(EXEMPI_LIBS)
 
 # Playlists using totem-pl-parser
-libextract_playlist_la_SOURCES = tracker-extract-playlist.c 
+libextract_playlist_la_SOURCES = tracker-extract-playlist.c  $(escape_sources)
 libextract_playlist_la_LDFLAGS = $(module_flags)
 libextract_playlist_la_LIBADD = $(GLIB2_LIBS) $(TOTEM_PL_PARSER_LIBS)
 

Added: trunk/src/tracker-extract/tracker-escape.c
==============================================================================
--- (empty file)
+++ trunk/src/tracker-extract/tracker-escape.c	Thu Dec 18 16:47:01 2008
@@ -0,0 +1,91 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "tracker-escape.h"
+#include <glib.h>
+#include <string.h>
+
+gchar *
+tracker_escape_metadata (const gchar *str)
+{
+        gchar *dest, *d;
+
+        d = dest = g_malloc (strlen (str) * 4 + 1);
+
+        while (*str) {
+                switch (*str) {
+                case '\n':
+                        *d++ = '\\';
+                        *d++ = 'n';
+                        break;
+                case '\t':
+                        *d++ = '\\';
+                        *d++ = 't';
+                        break;
+                case '\\':
+                        *d++ = '\\';
+                        *d++ = '\\';
+                        break;
+                case '|':
+                case ';':
+                case '=':
+                {
+                        /* special case fields separators */
+                        gchar *octal_str, *o;
+
+                        o = octal_str = g_strdup_printf ("\\%o", *str);
+
+                        while (*o) {
+                                *d++ = *o++;
+                        }
+
+                        g_free (octal_str);
+                        break;
+                }
+                default:
+                        *d++ = *str;
+                        break;
+                }
+
+                str++;
+        }
+
+        *d = '\0';
+
+        return dest;
+}
+
+gchar *
+tracker_escape_metadata_printf (const gchar *format,
+                                ...)
+{
+        va_list args;
+        gchar *str, escaped;
+
+        va_start (args, format);
+        str = g_strdup_vprintf (format, args);
+        va_end (args);
+
+        escaped = tracker_escape_metadata (str);
+        g_free (str);
+
+        return escaped;
+}

Copied: trunk/src/tracker-extract/tracker-escape.h (from r2732, /trunk/src/tracker-extract/tracker-extract-xmp.c)
==============================================================================
--- /trunk/src/tracker-extract/tracker-extract-xmp.c	(original)
+++ trunk/src/tracker-extract/tracker-escape.h	Thu Dec 18 16:47:01 2008
@@ -1,5 +1,5 @@
-/* Tracker Extract - extracts embedded metadata from files
- * Copyright (C) 2007, Jason Kivlighn (jkivlighn gmail com)
+/*
+ * Copyright (C) 2008, Nokia
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
@@ -17,34 +17,17 @@
  * Boston, MA  02110-1301, USA.
  */
 
-#include "config.h"
+#ifndef __TRACKER_ESCAPE_H__
+#define __TRACKER_ESCAPE_H__
 
 #include <glib.h>
 
-#include "tracker-extract.h"
-#include "tracker-xmp.h"
+G_BEGIN_DECLS
 
+gchar * tracker_escape_metadata        (const gchar *str);
+gchar * tracker_escape_metadata_printf (const gchar *format,
+                                        ...);
 
-static void
-tracker_extract_xmp (const gchar* filename, GHashTable *metadata)
-{
-	gchar *contents;
-	gsize length;
-	GError *error;
+G_END_DECLS
 
-	if ( g_file_get_contents ( filename, &contents, &length, &error ) )
-		tracker_read_xmp (contents, length, metadata);
-}
-
-
-TrackerExtractorData data[] = {
-	{ "application/rdf+xml", tracker_extract_xmp },
-	{ NULL, NULL }
-};
-
-
-TrackerExtractorData *
-tracker_get_extractor_data (void)
-{
-	return data;
-}
+#endif /* __TRACKER_ESCAPE_H__ */

Modified: trunk/src/tracker-extract/tracker-extract-abw.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-abw.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-abw.c	Thu Dec 18 16:47:01 2008
@@ -35,6 +35,7 @@
 #include <glib/gstdio.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 static void extract_abw (const gchar *filename,
 			 GHashTable  *metadata);
@@ -74,27 +75,27 @@
 			if (g_str_has_prefix (line, "<m key=\"dc.title\">")) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Title"),
-						     g_strdup (line + 18));
+						     tracker_escape_metadata (line + 18));
 			}
 			else if (g_str_has_prefix (line, "<m key=\"dc.subject\">")) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Subject"),
-						     g_strdup (line + 20));
+						     tracker_escape_metadata (line + 20));
 			}
 			else if (g_str_has_prefix (line, "<m key=\"dc.creator\">")) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Author"),
-						     g_strdup (line + 20));
+						     tracker_escape_metadata (line + 20));
 			}
 			else if (g_str_has_prefix (line, "<m key=\"abiword.keywords\">")) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Keywords"),
-						     g_strdup (line + 26));
+						     tracker_escape_metadata (line + 26));
 			}
 			else if (g_str_has_prefix (line, "<m key=\"dc.description\">")) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Comments"),
-						     g_strdup (line + 24));
+						     tracker_escape_metadata (line + 24));
 			}
 
 			g_free (line);

Modified: trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c	Thu Dec 18 16:47:01 2008
@@ -368,7 +368,7 @@
 {
 	gchar *str_info;
 
-	str_info = g_strdup_printf ("%" G_GINT64_FORMAT, info);
+	str_info = tracker_escape_metadata_printf ("%" G_GINT64_FORMAT, info);
 	g_hash_table_insert (metadata, key, str_info);
 }
 
@@ -379,7 +379,7 @@
 {
 	gchar *str_info;
 
-	str_info = g_strdup_printf ("%d", info);
+	str_info = tracker_escape_metadata_printf ("%d", info);
 	g_hash_table_insert (metadata, key, str_info);
 }
 
@@ -399,10 +399,10 @@
 		if (ret && s[0] != '\0') {
 			g_hash_table_insert (metadata,
 					     g_strdup (key),
-					     s);
-		} else {
-			g_free (s);
+					     tracker_escape_metadata (s));
 		}
+
+		g_free (s);
 	}
 }
 
@@ -420,7 +420,7 @@
 	if (ret) {
 		g_hash_table_insert (metadata,
 				     g_strdup (key),
-				     g_strdup_printf ("%d", n));
+				     tracker_escape_metadata_printf ("%d", n));
 	}
 }
 
@@ -438,7 +438,7 @@
 	if (ret) {
 		g_hash_table_insert (metadata,
 				     g_strdup (key),
-				     g_strdup_printf ("%f", n));
+				     tracker_escape_metadata_printf ("%f", n));
 	}
 }
 
@@ -460,7 +460,7 @@
 		if (g_date_strftime (buf, 10, "%Y", date)) {
 			g_hash_table_insert (metadata,
 					     g_strdup (key),
-					     g_strdup (buf));
+					     tracker_escape_metadata (buf));
 		}
 	}
 

Modified: trunk/src/tracker-extract/tracker-extract-gstreamer.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-gstreamer.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-gstreamer.c	Thu Dec 18 16:47:01 2008
@@ -403,7 +403,7 @@
 {
 	gchar *str_info;
 
-	str_info = g_strdup_printf ("%" G_GINT64_FORMAT, info);
+	str_info = tracker_escape_metadata_printf ("%" G_GINT64_FORMAT, info);
 	g_hash_table_insert (metadata, key, str_info);
 }
 
@@ -414,7 +414,7 @@
 {
 	gchar *str_info;
 
-	str_info = g_strdup_printf ("%d", info);
+	str_info = tracker_escape_metadata_printf ("%d", info);
 	g_hash_table_insert (metadata, key, str_info);
 }
 
@@ -434,10 +434,10 @@
 		if (ret && s[0] != '\0') {
 			g_hash_table_insert (metadata,
 					     g_strdup (key),
-					     s);
-		} else {
-			g_free (s);
+					     tracker_escape_metadata (s));
 		}
+
+		g_free (s);
 	}
 }
 
@@ -455,7 +455,7 @@
 	if (ret) {
 		g_hash_table_insert (metadata,
 				     g_strdup (key),
-				     g_strdup_printf ("%d", n));
+				     tracker_escape_metadata_printf ("%d", n));
 	}
 }
 
@@ -473,7 +473,7 @@
 	if (ret) {
 		g_hash_table_insert (metadata,
 				     g_strdup (key),
-				     g_strdup_printf ("%f", n));
+				     tracker_escape_metadata_printf ("%f", n));
 	}
 }
 
@@ -495,7 +495,7 @@
 		if (g_date_strftime (buf, 10, "%Y", date)) {
 			g_hash_table_insert (metadata,
 					     g_strdup (key),
-					     g_strdup (buf));
+					     tracker_escape_metadata (buf));
 		}
 	}
 
@@ -906,7 +906,8 @@
 			
 			g_hash_table_insert (metadata,
 					     g_strdup ("Audio:Title"),
-					     title);
+					     tracker_escape_metadata (title));
+			g_free (title);
 		}
 		
 		if (!g_hash_table_lookup (metadata, "Audio:Album")) {
@@ -952,7 +953,8 @@
 			
 			g_hash_table_insert (metadata,
 					     g_strdup ("Video:Title"),
-					     title);
+					     tracker_escape_metadata (title));
+			g_free (title);
 		}
 		
 		if (!g_hash_table_lookup (metadata, "Video:Author")) {

Modified: trunk/src/tracker-extract/tracker-extract-html.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-html.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-html.c	Thu Dec 18 16:47:01 2008
@@ -27,6 +27,7 @@
 #include <libxml/HTMLparser.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 typedef enum {
 	READ_TITLE,
@@ -110,7 +111,7 @@
 			if (href) {
 				g_hash_table_insert (((HTMLParseInfo*) info)->metadata,
 						     g_strdup ("File:License"),
-						     g_strdup ((gchar*)  href));
+						     tracker_escape_metadata ((gchar*)  href));
 			}
 		}
 	} else if (strcasecmp ((gchar*)name, "title") == 0) {
@@ -124,7 +125,7 @@
 			if (author) {
 				g_hash_table_insert (((HTMLParseInfo*) info)->metadata,
 						     g_strdup ("Doc:Author"),
-						     g_strdup ((gchar*) author));
+						     tracker_escape_metadata ((gchar*) author));
 			}
 		}
 
@@ -136,7 +137,7 @@
 			if (desc) {
 				g_hash_table_insert (((HTMLParseInfo*) info)->metadata,
 						     g_strdup ("Doc:Comments"),
-						     g_strdup ((gchar*) desc));
+						     tracker_escape_metadata ((gchar*) desc));
 			}
 		}
 
@@ -149,7 +150,7 @@
 			if (keywords) {
 				g_hash_table_insert (((HTMLParseInfo*) info)->metadata,
 						     g_strdup ("Doc:Keywords"),
-						     g_strdup ((gchar*) keywords));
+						     tracker_escape_metadata ((gchar*) keywords));
 			}
 		}
 	}
@@ -164,7 +165,7 @@
 	case READ_TITLE:
 		g_hash_table_insert (((HTMLParseInfo*) info)->metadata,
 				     g_strdup ("Doc:Title"),
-				     g_strdup ((gchar*) ch));
+				     tracker_escape_metadata ((gchar*) ch));
 		break;
 	default:
 		break;

Modified: trunk/src/tracker-extract/tracker-extract-jpeg.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-jpeg.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-jpeg.c	Thu Dec 18 16:47:01 2008
@@ -193,13 +193,18 @@
 			exif_entry_get_value (entry, buffer, 1024);
 
 			if (p->post) {
+				gchar *str;
+
+				str = (*p->post) (buffer);
+
 				g_hash_table_insert (metadata,
 						     g_strdup (p->name),
-						     (*p->post) (buffer));
+						     tracker_escape_metadata (str));
+				g_free (str);
 			} else {
 				g_hash_table_insert (metadata,
 						     g_strdup (p->name),
-						     g_strdup (buffer));
+						     tracker_escape_metadata (buffer));
 			}
 		}
 	}
@@ -249,12 +254,13 @@
 		while (marker) {
 			switch (marker->marker) {
 			case JPEG_COM:
-				str = (gchar*) marker->data;
 				len = marker->data_length;
+				str = g_strndup ((gchar*) marker->data, len);
 
 				g_hash_table_insert (metadata,
 						     g_strdup ("Image:Comments"),
-						     g_strndup (str, len));
+						     tracker_escape_metadata (str));
+				g_free (str);
 				break;
 
 			case JPEG_APP0+1:
@@ -289,10 +295,10 @@
 		/* We want native size to have priority over EXIF, XMP etc */
 		g_hash_table_insert (metadata,
 				     g_strdup ("Image:Width"),
-				     g_strdup_printf ("%u", cinfo.image_width));
+				     tracker_escape_metadata_printf ("%u", cinfo.image_width));
 		g_hash_table_insert (metadata,
 				     g_strdup ("Image:Height"),
-				     g_strdup_printf ("%u", cinfo.image_height));
+				     tracker_escape_metadata_printf ("%u", cinfo.image_height));
 
 		/* Check that we have the minimum data. FIXME We should not need to do this */
 
@@ -300,10 +306,14 @@
 			struct stat st;
 
 			if (g_lstat(filename, &st) >= 0) {
+				gchar *date;
 
-				g_hash_table_insert (metadata, 
-					     g_strdup ("Image:Date"), 
-					     tracker_date_to_string (st.st_mtime));				
+				date = tracker_date_to_string (st.st_mtime);
+
+				g_hash_table_insert (metadata,
+						     g_strdup ("Image:Date"),
+						     tracker_escape_metadata (date));
+				g_free (date);
 			}
 		}
 

Modified: trunk/src/tracker-extract/tracker-extract-libxine.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-libxine.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-libxine.c	Thu Dec 18 16:47:01 2008
@@ -28,7 +28,7 @@
 {
 	char *str_info;
 
-	str_info = g_strdup_printf ("%d", info);
+	str_info = tracker_escape_metadata_printf ("%d", info);
 	g_hash_table_insert (metadata, key, str_info);
 }
 
@@ -146,7 +146,8 @@
 
 		video_codec = xine_get_meta_info (stream, XINE_META_INFO_VIDEOCODEC);
 		if (video_codec) {
-			g_hash_table_insert (metadata, g_strdup ("Video:Codec"), g_strdup (video_codec));
+			g_hash_table_insert (metadata, g_strdup ("Video:Codec"),
+                                             tracker_escape_metadata (video_codec));
 		}
 	}
 
@@ -174,7 +175,8 @@
 
 		audio_codec = xine_get_meta_info (stream, XINE_META_INFO_AUDIOCODEC);
 		if (audio_codec) {
-			g_hash_table_insert (metadata, g_strdup ("Audio:Codec"), g_strdup (audio_codec));
+			g_hash_table_insert (metadata, g_strdup ("Audio:Codec"),
+                                             tracker_escape_metadata (audio_codec));
 		}
 	}
 
@@ -184,48 +186,58 @@
 	comment = xine_get_meta_info (stream, XINE_META_INFO_COMMENT);
 	if (comment) {
 		if (has_video) {
-			g_hash_table_insert (metadata, g_strdup ("Video:Comment"), g_strdup (comment));
+			g_hash_table_insert (metadata, g_strdup ("Video:Comment"),
+                                             tracker_escape_metadata (comment));
 		} else if (has_audio) {
-			g_hash_table_insert (metadata, g_strdup ("Audio:Comment"), g_strdup (comment));
+			g_hash_table_insert (metadata, g_strdup ("Audio:Comment"),
+                                             tracker_escape_metadata (comment));
 		}
 	}
 
 	title = xine_get_meta_info (stream, XINE_META_INFO_TITLE);
 	if (title) {
 		if (has_video) {
-			g_hash_table_insert (metadata, g_strdup ("Video:Title"), g_strdup (title));
+			g_hash_table_insert (metadata, g_strdup ("Video:Title"),
+                                             tracker_escape_metadata (title));
 		} else if (has_audio) {
-			g_hash_table_insert (metadata, g_strdup ("Audio:Title"), g_strdup (title));
+			g_hash_table_insert (metadata, g_strdup ("Audio:Title"),
+                                             tracker_escape_metadata (title));
 		}
 	}
 
 	author = xine_get_meta_info (stream, XINE_META_INFO_ARTIST);
 	if (author) {
 		if (has_video) {
-			g_hash_table_insert (metadata, g_strdup ("Video:Author"), g_strdup (author));
+			g_hash_table_insert (metadata, g_strdup ("Video:Author"),
+                                             tracker_escape_metadata (author));
 		} else if (has_audio) {
-			g_hash_table_insert (metadata, g_strdup ("Audio:Author"), g_strdup (author));
+			g_hash_table_insert (metadata, g_strdup ("Audio:Author"),
+                                             tracker_escape_metadata (author));
 		}
 	}
 
 	album = xine_get_meta_info (stream, XINE_META_INFO_ALBUM);
 	if (album) {
-		g_hash_table_insert (metadata, g_strdup ("Audio:Album"), g_strdup (album));
+		g_hash_table_insert (metadata, g_strdup ("Audio:Album"),
+                                     tracker_escape_metadata (album));
 	}
 
 	year = xine_get_meta_info (stream, XINE_META_INFO_YEAR);
 	if (year) {
-		g_hash_table_insert (metadata, g_strdup ("Audio:Year"), g_strdup (year));
+		g_hash_table_insert (metadata, g_strdup ("Audio:Year"),
+                                     tracker_escape_metadata (year));
 	}
 
 	genre = xine_get_meta_info (stream, XINE_META_INFO_GENRE);
 	if (genre) {
-		g_hash_table_insert (metadata, g_strdup ("Audio:Genre"), g_strdup (genre));
+		g_hash_table_insert (metadata, g_strdup ("Audio:Genre"),
+                                     tracker_escape_metadata (genre));
 	}
 
 	track = xine_get_meta_info (stream, XINE_META_INFO_TRACK_NUMBER);
 	if (track) {
-		g_hash_table_insert (metadata, g_strdup ("Audio:Track"), g_strdup (track));
+		g_hash_table_insert (metadata, g_strdup ("Audio:Track"),
+                                     tracker_escape_metadata (track));
 	}
 
 	/* FIXME: "Video.Copyright" seems missing */

Modified: trunk/src/tracker-extract/tracker-extract-mp3.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-mp3.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-mp3.c	Thu Dec 18 16:47:01 2008
@@ -41,6 +41,7 @@
 
 #include "tracker-extract.h"
 #include "tracker-albumart.h"
+#include "tracker-escape.h"
 
 /* FIXME The max file read is not a good idea as basic 
  * id3 are the _last_ 128 bits of the file. We should
@@ -505,14 +506,13 @@
 
 	g_hash_table_insert (metadata,
 			     g_strdup ("Audio:Duration"),
-			     g_strdup_printf ("%d", length));
+			     tracker_escape_metadata_printf ("%d", length));
 	g_hash_table_insert (metadata,
 			     g_strdup ("Audio:Samplerate"),
-			     g_strdup_printf ("%d", sample_rate));
+			     tracker_escape_metadata_printf ("%d", sample_rate));
 	g_hash_table_insert (metadata,
 			     g_strdup ("Audio:Bitrate"),
-			     g_strdup_printf ("%d", avg_bps));
-
+			     tracker_escape_metadata_printf ("%d", avg_bps));
 }
 
 static void
@@ -672,11 +672,11 @@
 
 					g_hash_table_insert (metadata,
 							     g_strdup (tmap[i].type),
-							     word);
-				} else {
-					g_free (word);
+							     tracker_escape_metadata (word));
 				}
 
+				g_free (word);
+
 				break;
 			}
 
@@ -741,13 +741,12 @@
 			if (word != NULL && strlen (word) > 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Audio:Comment"),
-						     word);	
-			} else {
-				g_free (word);
+						     tracker_escape_metadata (word));
 			}
 
-		}	
-	
+			g_free (word);
+		}
+
 
 		/* Check for embedded images */
 		if (strncmp (&data[pos], "APIC", 4) == 0) {
@@ -939,11 +938,11 @@
 
 					g_hash_table_insert (metadata,
 							     g_strdup (tmap[i].type),
-							     word);
-				} else {
-					g_free (word);
+							     tracker_escape_metadata (word));
 				}
 
+				g_free (word);
+
 				break;
 			}
 
@@ -997,11 +996,10 @@
 			if (word != NULL && strlen (word) > 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Audio:Comment"),
-						     word);	
-			} else {
-				g_free (word);
+						     tracker_escape_metadata (word));
 			}
 
+			g_free (word);
 		}
 
 		/* Check for embedded images */
@@ -1157,7 +1155,7 @@
 
 					g_hash_table_insert (metadata,
 							     g_strdup (tmap[i].type),
-							     g_strdup (word));
+							     tracker_escape_metadata (word));
 				} else {
 					g_free (word);
 				}
@@ -1250,37 +1248,37 @@
 	if (info.title && strlen (info.title) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Title"),
-				     g_strdup (info.title));
+				     tracker_escape_metadata (info.title));
 	}
 
 	if (info.artist && strlen (info.artist) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Artist"),
-				     g_strdup (info.artist));
+				     tracker_escape_metadata (info.artist));
 	}
 
 	if (info.album && strlen (info.album) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Album"),
-				     g_strdup (info.album));
+				     tracker_escape_metadata (info.album));
 	}
 
 	if (info.year && strlen (info.year) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:ReleaseDate"),
-				     g_strdup (info.year));
+				     tracker_escape_metadata (info.year));
 	}
 
 	if (info.genre && strlen (info.genre) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Genre"),
-				     g_strdup (info.genre));
+				     tracker_escape_metadata (info.genre));
 	}
 
 	if (info.comment && strlen (info.comment) > 0) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Comment"),
-				     g_strdup (info.comment));
+				     tracker_escape_metadata (info.comment));
 	}
 
 	free (info.title);
@@ -1327,7 +1325,9 @@
 			
 		g_hash_table_insert (metadata,
 				     g_strdup ("Audio:Title"),
-				     title);
+				     tracker_escape_metadata (title));
+
+		g_free (title);
 	}
 
 	if (!g_hash_table_lookup (metadata, "Audio:Album")) {

Modified: trunk/src/tracker-extract/tracker-extract-mplayer.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-mplayer.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-mplayer.c	Thu Dec 18 16:47:01 2008
@@ -29,6 +29,7 @@
 #include <libtracker-common/tracker-os-dependant.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 static void extract_mplayer (const gchar *filename,
 			     GHashTable  *metadata);
@@ -81,7 +82,7 @@
 {
 	g_hash_table_insert (user_data,
 			     g_strdup (key),
-			     g_strdup (value));
+			     tracker_escape_metadata (value));
 }
 
 static void
@@ -149,7 +150,7 @@
 					if (g_str_has_prefix (*line, audio_tags[i][0])) {
 						g_hash_table_insert (metadata,
 								     g_strdup (audio_tags[i][1]),
-								     g_strdup ((*line) + strlen (audio_tags[i][0]) + 1));
+								     tracker_escape_metadata ((*line) + strlen (audio_tags[i][0]) + 1));
 						break;
 					}
 				}
@@ -162,7 +163,7 @@
 					if (g_str_has_prefix (*line, video_tags[i][0])) {
 						g_hash_table_insert (metadata,
 								     g_strdup (video_tags[i][1]),
-								     g_strdup ((*line) + strlen (video_tags[i][0]) + 1));
+								     tracker_escape_metadata ((*line) + strlen (video_tags[i][0]) + 1));
 						break;
 					}
 				}

Modified: trunk/src/tracker-extract/tracker-extract-msoffice.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-msoffice.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-msoffice.c	Thu Dec 18 16:47:01 2008
@@ -91,7 +91,9 @@
 				}
 
 				if (str_val) {
-					g_hash_table_insert (table, g_strdup (key), str_val);
+					g_hash_table_insert (table, g_strdup (key),
+							     tracker_escape_metadata (str_val));
+					g_free (str_val);
 				}
 			}
 

Modified: trunk/src/tracker-extract/tracker-extract-oasis.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-oasis.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-oasis.c	Thu Dec 18 16:47:01 2008
@@ -27,6 +27,7 @@
 #include <libtracker-common/tracker-os-dependant.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 typedef enum {
 	READ_TITLE,
@@ -142,12 +143,12 @@
 			if (strcmp (*a, "meta:word-count") == 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:WordCount"),
-						     g_strdup (*v));
+						     tracker_escape_metadata (*v));
 			}
 			else if (strcmp (*a, "meta:page-count") == 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:PageCount"),
-						     g_strdup (*v));
+						     tracker_escape_metadata (*v));
 			}
 		}
 
@@ -190,46 +191,50 @@
 	case READ_TITLE:
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Title"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 	case READ_SUBJECT:
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Subject"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 	case READ_AUTHOR:
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Author"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 	case READ_KEYWORDS: {
 		gchar *keywords;
 
 		if ((keywords = g_hash_table_lookup (metadata, "Doc:Keywords"))) {
+			gchar *escaped;
+
+			escaped = tracker_escape_metadata (text);
 			g_hash_table_replace (metadata,
 					      g_strdup ("Doc:Keywords"),
-					      g_strconcat (keywords, ",", text, NULL));
+					      g_strconcat (keywords, ",", escaped, NULL));
+			g_free (escaped);
 		} else {
 			g_hash_table_insert (metadata,
 					     g_strdup ("Doc:Keywords"),
-					     g_strdup (text));
+					     tracker_escape_metadata (text));
 		}
 	}
 		break;
 	case READ_COMMENTS:
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Comments"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 	case READ_CREATED:
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Created"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 	case READ_FILE_OTHER:
 		g_hash_table_insert (metadata,
 				     g_strdup ("File:Other"),
-				     g_strdup (text));
+				     tracker_escape_metadata (text));
 		break;
 
 	default:

Modified: trunk/src/tracker-extract/tracker-extract-pdf.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-pdf.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-pdf.c	Thu Dec 18 16:47:01 2008
@@ -79,27 +79,27 @@
 	if (!tracker_is_empty_string (title)) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Title"),
-				     g_strdup (title));
+				     tracker_escape_metadata (title));
 	}
 	if (!tracker_is_empty_string (author)) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Author"),
-				     g_strdup (author));
+				     tracker_escape_metadata (author));
 	}
 	if (!tracker_is_empty_string (subject)) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Subject"),
-				     g_strdup (subject));
+				     tracker_escape_metadata (subject));
 	}
 	if (!tracker_is_empty_string (keywords)) {
 		g_hash_table_insert (metadata,
 				     g_strdup ("Doc:Keywords"),
-				     g_strdup (keywords));
+				     tracker_escape_metadata (keywords));
 	}
 
 	g_hash_table_insert (metadata,
 			     g_strdup ("Doc:PageCount"),
-			     g_strdup_printf ("%d", poppler_document_get_n_pages (document)));
+			     tracker_escape_metadata_printf ("%d", poppler_document_get_n_pages (document)));
 
 	if ( metadata_xml ) {
 		tracker_read_xmp (metadata_xml, strlen (metadata_xml), metadata);

Modified: trunk/src/tracker-extract/tracker-extract-playlist.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-playlist.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-playlist.c	Thu Dec 18 16:47:01 2008
@@ -110,11 +110,11 @@
 
 	g_hash_table_insert (metadata, 
 			     g_strdup (PLAYLIST_PROPERTY_DURATION), 
-			     g_strdup_printf ("%d", data.total_time));
+			     tracker_escape_metadata_printf ("%d", data.total_time));
 
 	g_hash_table_insert (metadata, 
 			     g_strdup (PLAYLIST_PROPERTY_NO_TRACKS), 
-			     g_strdup_printf ("%d", data.track_counter));
+			     tracker_escape_metadata_printf ("%d", data.track_counter));
 
 	g_free (proper_filename);
         g_object_unref (pl);

Modified: trunk/src/tracker-extract/tracker-extract-png.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-png.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-png.c	Thu Dec 18 16:47:01 2008
@@ -41,6 +41,7 @@
 
 #include "tracker-extract.h"
 #include "tracker-xmp.h"
+#include "tracker-escape.h"
 
 #define RFC1123_DATE_FORMAT "%d %B %Y %H:%M:%S %z"
 
@@ -120,12 +121,13 @@
 						if (str) {
 							g_hash_table_insert (metadata,
 									     g_strdup (tag_processors[j].type),
-									     str);
+									     tracker_escape_metadata (str));
+							g_free (str);
 						}
 					} else {
 						g_hash_table_insert (metadata,
 								     g_strdup (tag_processors[j].type),
-								     g_strdup (text_ptr[i].text));
+								     tracker_escape_metadata (text_ptr[i].text));
 					}
 					
 					break;
@@ -236,10 +238,10 @@
 		 */
 		g_hash_table_insert (metadata,
 				     g_strdup ("Image:Width"),
-				     g_strdup_printf ("%ld", width));
+				     tracker_escape_metadata_printf ("%ld", width));
 		g_hash_table_insert (metadata,
 				     g_strdup ("Image:Height"),
-				     g_strdup_printf ("%ld", height));
+				     tracker_escape_metadata_printf ("%ld", height));
 		
 		/* Check that we have the minimum data. FIXME We should not need to do this */
 
@@ -247,10 +249,14 @@
 			struct stat st;
 
 			if (g_lstat(filename, &st) >= 0) {
+				gchar *date;
 
-				g_hash_table_insert (metadata, 
-					     g_strdup ("Image:Date"), 
-					     tracker_date_to_string (st.st_mtime));				
+				date = tracker_date_to_string (st.st_mtime);
+
+				g_hash_table_insert (metadata,
+						     g_strdup ("Image:Date"),
+						     tracker_escape_metadata (date));
+				g_free (date);
 			}
 		}
 

Modified: trunk/src/tracker-extract/tracker-extract-ps.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-ps.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-ps.c	Thu Dec 18 16:47:01 2008
@@ -38,6 +38,7 @@
 #include <libtracker-common/tracker-os-dependant.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 #ifndef HAVE_GETLINE
 
@@ -226,17 +227,17 @@
 			if (!header_finished && strncmp (line, "%%Copyright:", 12) == 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("File:Other"),
-						     g_strdup (line + 13));
+						     tracker_escape_metadata (line + 13));
 
 			} else if (!header_finished && strncmp (line, "%%Title:", 8) == 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Title"),
-						     g_strdup (line + 9));
+						     tracker_escape_metadata (line + 9));
 
 			} else if (!header_finished && strncmp (line, "%%Creator:", 10) == 0) {
 				g_hash_table_insert (metadata,
 						     g_strdup ("Doc:Author"),
-						     g_strdup (line + 11));
+						     tracker_escape_metadata (line + 11));
 
 			} else if (!header_finished && strncmp (line, "%%CreationDate:", 15) == 0) {
 				gchar *date;
@@ -246,7 +247,9 @@
 				if (date) {
 					g_hash_table_insert (metadata,
 							     g_strdup ("Doc:Created"),
-							     date);
+							     tracker_escape_metadata (date));
+
+					g_free (date);
 				}
 
 			} else if (strncmp (line, "%%Pages:", 8) == 0) {
@@ -255,7 +258,7 @@
 				} else {
 					g_hash_table_insert (metadata,
 							     g_strdup ("Doc:PageCount"),
-							     g_strdup (line + 9));
+							     tracker_escape_metadata (line + 9));
 				}
 			} else if (strncmp (line, "%%EndComments", 14) == 0) {
 				header_finished = TRUE;

Modified: trunk/src/tracker-extract/tracker-extract-tiff.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-tiff.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-tiff.c	Thu Dec 18 16:47:01 2008
@@ -189,11 +189,11 @@
 				if (tag->post) {
 					g_hash_table_insert (metadata,
 							     g_strdup (tag->name),
-							     g_strdup ((*tag->post) (buffer)));
+							     tracker_escape_metadata ((*tag->post) (buffer)));
 				} else {
 					g_hash_table_insert (metadata, 
 							     g_strdup (tag->name),
-							     g_strdup (buffer));
+							     tracker_escape_metadata (buffer));
 				}
 			}
 		}
@@ -236,11 +236,11 @@
 		if (tag->post) {
 			g_hash_table_insert (metadata, 
 					     g_strdup (tag->name),
-					     g_strdup ((*tag->post) (buffer)));
+					     tracker_escape_metadata ((*tag->post) (buffer)));
 		} else {
 			g_hash_table_insert (metadata, 
 					     g_strdup (tag->name),
-					     g_strdup (buffer));
+					     tracker_escape_metadata (buffer));
 		}
 	}
 
@@ -250,10 +250,14 @@
 		struct stat st;
 		
 		if (g_lstat(filename, &st) >= 0) {
-			
-			g_hash_table_insert (metadata, 
-					     g_strdup ("Image:Date"), 
-					     tracker_date_to_string (st.st_mtime));
+			gchar *date;
+
+			date = tracker_date_to_string (st.st_mtime);
+
+			g_hash_table_insert (metadata,
+					     g_strdup ("Image:Date"),
+					     tracker_escape_metadata (date));
+			g_free (date);
 		}
 	}
 

Modified: trunk/src/tracker-extract/tracker-extract-totem.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-totem.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-totem.c	Thu Dec 18 16:47:01 2008
@@ -26,6 +26,7 @@
 #include <libtracker-common/tracker-os-dependant.h>
 
 #include "tracker-extract.h"
+#include "tracker-escape.h"
 
 static gchar *tags[][2] = {
 	{ "TOTEM_INFO_VIDEO_HEIGHT",		"Video:Height"		},
@@ -74,7 +75,7 @@
 				if (g_str_has_prefix (*line, tags[i][0])) {
 					g_hash_table_insert (metadata,
 							     g_strdup (tags[i][1]),
-							     g_strdup ((*line) + strlen (tags[i][0]) + 1));
+							     tracker_escape_metadata ((*line) + strlen (tags[i][0]) + 1));
 					break;
 				}
 			}

Modified: trunk/src/tracker-extract/tracker-extract-xmp.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-xmp.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-xmp.c	Thu Dec 18 16:47:01 2008
@@ -23,6 +23,7 @@
 
 #include "tracker-extract.h"
 #include "tracker-xmp.h"
+#include "tracker-escape.h"
 
 
 static void

Modified: trunk/src/tracker-extract/tracker-extract.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract.c	(original)
+++ trunk/src/tracker-extract/tracker-extract.c	Thu Dec 18 16:47:01 2008
@@ -256,7 +256,7 @@
 		       gpointer value,
 		       gpointer user_data)
 {
-	gchar *value_utf8, *value_escaped;
+	gchar *value_utf8;
 
 	g_return_if_fail (key != NULL);
 	g_return_if_fail (value != NULL);
@@ -264,21 +264,15 @@
 	value_utf8 = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
 
 	if (value_utf8) {
-		value_escaped = g_strescape (value_utf8, NULL);
-
-		/* Replace any embedded semicolons or "=" as we use them for delimiters */
-		value_escaped = g_strdelimit (value_escaped, ";", ',');
-		value_escaped = g_strdelimit (value_escaped, "=", '-');
-		value_escaped = g_strstrip (value_escaped);
+		value_utf8 = g_strstrip (value_utf8);
 
 		debug ("Extractor - Found '%s' = '%s'",
 		       (gchar*) key,
 		       value_utf8);
 
-		g_print ("%s=%s;\n", (gchar*) key, value_escaped);
+		g_print ("%s=%s;\n", (gchar*) key, value_utf8);
 
 		g_free (value_utf8);
-		g_free (value_escaped);
 	}
 }
 

Modified: trunk/src/tracker-extract/tracker-extract.h
==============================================================================
--- trunk/src/tracker-extract/tracker-extract.h	(original)
+++ trunk/src/tracker-extract/tracker-extract.h	Thu Dec 18 16:47:01 2008
@@ -23,6 +23,7 @@
 #define __TRACKER_EXTRACT_H__
 
 #include <glib.h>
+#include "tracker-escape.h"
 
 G_BEGIN_DECLS
 

Modified: trunk/src/tracker-extract/tracker-xmp.c
==============================================================================
--- trunk/src/tracker-extract/tracker-xmp.c	(original)
+++ trunk/src/tracker-extract/tracker-xmp.c	Thu Dec 18 16:47:01 2008
@@ -50,12 +50,18 @@
 	if (append) {
 		gchar *orig;
 		if (g_hash_table_lookup_extended (metadata, key, NULL, (gpointer)&orig )) {
-			new_value = g_strconcat (orig, "|", value, NULL);
+			gchar *escaped;
+
+			escaped = tracker_escape_metadata (value);
+
+			new_value = g_strconcat (orig, "|", escaped, NULL);
+
+			g_free (escaped);
 		} else {
-			new_value = g_strdup (value);
+			new_value = tracker_escape_metadata (value);
 		}
 	} else {
-		new_value = g_strdup (value);
+		new_value = tracker_escape_metadata (value);
 	}
 
 	g_hash_table_insert (metadata, g_strdup (key), new_value);



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