Commit 67b62dfc authored by Martyn James Russell's avatar Martyn James Russell

Renamed 'Extractor' to 'Extract'

	* src/tracker-extract/dummy.c:
	* src/tracker-extract/tracker-extract-abw.c:
	* src/tracker-extract/tracker-extract-exif.c:
	* src/tracker-extract/tracker-extract-gstreamer-helix.c:
	* src/tracker-extract/tracker-extract-gstreamer-tagreadbin.c:
	* src/tracker-extract/tracker-extract-gstreamer.c:
	* src/tracker-extract/tracker-extract-html.c:
	* src/tracker-extract/tracker-extract-imagemagick.c:
	* src/tracker-extract/tracker-extract-jpeg.c:
	* src/tracker-extract/tracker-extract-libxine.c:
	* src/tracker-extract/tracker-extract-mp3.c: 
	* src/tracker-extract/tracker-extract-mplayer.c:
	* src/tracker-extract/tracker-extract-msoffice.c:
	* src/tracker-extract/tracker-extract-oasis.c: 
	* src/tracker-extract/tracker-extract-pdf.c: 
	* src/tracker-extract/tracker-extract-playlist.c:
	* src/tracker-extract/tracker-extract-png.c:
	* src/tracker-extract/tracker-extract-ps.c:
	* src/tracker-extract/tracker-extract-tiff.c:
	* src/tracker-extract/tracker-extract-totem.c:
	* src/tracker-extract/tracker-extract-vorbis.c:
	* src/tracker-extract/tracker-extract-xmp.c: 
	* src/tracker-extract/tracker-xmp.c: Renamed 'Extractor' to 'Extract' 

	* data/dbus/Makefile.am:
	* data/dbus/org.freedesktop.Tracker.Extract.service.in:
	* data/dbus/tracker-extract.xml:
	* src/tracker-extract/Makefile.am:
	* src/tracker-extract/tracker-extract.[ch]: New DBus object with
	introspection to request metadata for a file and mime type.

	* src/tracker-indexer/Makefile.am:
	* src/tracker-indexer/tracker-dbus.h:
	* src/tracker-indexer/tracker-module-metadata-utils.c: Call the
	new extracter over DBus.

	* tests/tracker-extract/tracker-extract-jpeg-test.c:
	* tests/tracker-extract/tracker-extract-mp3-test.c:
	* tests/tracker-extract/tracker-extract-png-test.c:
	* tests/tracker-extract/tracker-extract-test-utils.c:
	* tests/tracker-extract/tracker-extract-test-utils.h:
	* tests/tracker-extract/tracker-extract-testsuite-avi.c:
	* tests/tracker-extract/tracker-extract-testsuite-generic.[ch]:
	* tests/tracker-extract/tracker-extract-testsuite-jpeg.c:
	* tests/tracker-extract/tracker-extract-testsuite-mp3.c:
	* tests/tracker-extract/tracker-extract-testsuite-png.c:
	* tests/tracker-extract/tracker-extract-testsuite-tiff.c:
	* tests/tracker-extract/tracker-extract-tiff-test.c: Updated tests
	accordingly.

svn path=/trunk/; revision=2895
parent 7d8dd05d
2009-02-06 Martyn Russell <martyn@imendio.com>
* src/tracker-extract/tracker-escape.[ch]: Make the escape
functions simply duplicate the functions with g_strdup() and
g_strdup_printf().
* src/tracker-extract/dummy.c:
* src/tracker-extract/tracker-extract-abw.c:
* src/tracker-extract/tracker-extract-exif.c:
* src/tracker-extract/tracker-extract-gstreamer-helix.c:
* src/tracker-extract/tracker-extract-gstreamer-tagreadbin.c:
* src/tracker-extract/tracker-extract-gstreamer.c:
* src/tracker-extract/tracker-extract-html.c:
* src/tracker-extract/tracker-extract-imagemagick.c:
* src/tracker-extract/tracker-extract-jpeg.c:
* src/tracker-extract/tracker-extract-libxine.c:
* src/tracker-extract/tracker-extract-mp3.c:
* src/tracker-extract/tracker-extract-mplayer.c:
* src/tracker-extract/tracker-extract-msoffice.c:
* src/tracker-extract/tracker-extract-oasis.c:
* src/tracker-extract/tracker-extract-pdf.c:
* src/tracker-extract/tracker-extract-playlist.c:
* src/tracker-extract/tracker-extract-png.c:
* src/tracker-extract/tracker-extract-ps.c:
* src/tracker-extract/tracker-extract-tiff.c:
* src/tracker-extract/tracker-extract-totem.c:
* src/tracker-extract/tracker-extract-vorbis.c:
* src/tracker-extract/tracker-extract-xmp.c:
* src/tracker-extract/tracker-xmp.c: Renamed 'Extractor' to 'Extract'
* data/dbus/Makefile.am:
* data/dbus/org.freedesktop.Tracker.Extract.service.in:
* data/dbus/tracker-extract.xml:
* src/tracker-extract/Makefile.am:
* src/tracker-extract/tracker-extract.[ch]: New DBus object with
introspection to request metadata for a file and mime type.
* src/tracker-extract/tracker-main.[ch]: Use logging and now log
all messages to tracker-extract.log.
* src/tracker-indexer/Makefile.am:
* src/tracker-indexer/tracker-dbus.h:
* src/tracker-indexer/tracker-module-metadata-utils.c: Call the
new extracter over DBus.
* tests/tracker-extract/tracker-extract-jpeg-test.c:
* tests/tracker-extract/tracker-extract-mp3-test.c:
* tests/tracker-extract/tracker-extract-png-test.c:
* tests/tracker-extract/tracker-extract-test-utils.c:
* tests/tracker-extract/tracker-extract-test-utils.h:
* tests/tracker-extract/tracker-extract-testsuite-avi.c:
* tests/tracker-extract/tracker-extract-testsuite-generic.[ch]:
* tests/tracker-extract/tracker-extract-testsuite-jpeg.c:
* tests/tracker-extract/tracker-extract-testsuite-mp3.c:
* tests/tracker-extract/tracker-extract-testsuite-png.c:
* tests/tracker-extract/tracker-extract-testsuite-tiff.c:
* tests/tracker-extract/tracker-extract-tiff-test.c: Updated tests
accordingly.
2009-02-06 Carlos Garnacho <carlos@imendio.com>
Pass also the amount of processed items over to trackerd, use this
......
......@@ -9,13 +9,15 @@ config_DATA = \
tracker-metadata.xml \
tracker-search.xml \
tracker-xesam.xml \
tracker-indexer.xml
tracker-indexer.xml \
tracker-extract.xml
# Services
servicedir = $(DBUS_SERVICES_DIR)
service_in_files = \
org.freedesktop.Tracker.service.in \
org.freedesktop.Tracker.Indexer.service.in
org.freedesktop.Tracker.Indexer.service.in \
org.freedesktop.Tracker.Extract.service.in
service_DATA = $(service_in_files:.service.in=.service)
%.service: %.service.in
......
[D-BUS Service]
Name=org.freedesktop.Tracker.Extract
Exec=@libexecdir@/tracker-extract
<?xml version="1.0" encoding="UTF-8"?>
<!--
<busconfig>
<policy context="default">
<deny send_interface="org.freedesktop.Tracker.Indexer"/>
<allow send_destination="org.freedesktop.Tracker"/>
</policy>
</busconfig>
-->
<node name="/">
<interface name="org.freedesktop.Tracker.Extract">
<method name="GetMetadata">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type="s" name="path" direction="in" />
<arg type="s" name="mime" direction="in" />
<arg type="a{ss}" name="values" direction="out" />
</method>
</interface>
</node>
......@@ -6,6 +6,7 @@ modulesdir = $(libdir)/tracker/extract-modules
INCLUDES = \
-DLOCALEDIR=\""$(localedir)"\" \
-DMODULESDIR=\"$(modulesdir)\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(EXEMPI_CFLAGS) \
......@@ -225,7 +226,7 @@ tracker_extract_LDADD = \
$(GLIB2_LIBS)
dbus_sources = \
tracker-extractor-glue.h
tracker-extract-glue.h
%-glue.h: $(top_srcdir)/data/dbus/%.xml
$(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=$(subst -,_,$*) $^
......
......@@ -28,7 +28,7 @@
#include <glib.h>
#include <glib/gstdio.h>
#include "tracker-extract.h"
#include "tracker-main.h"
/*
* Prototype of the parsing function.
......
......@@ -25,74 +25,3 @@
#include <glib.h>
#include "tracker-escape.h"
gchar *
tracker_escape_metadata (const gchar *str)
{
gchar *dest, *d;
if (!str) {
return NULL;
}
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;
}
......@@ -25,9 +25,9 @@
G_BEGIN_DECLS
gchar *tracker_escape_metadata (const gchar *str);
gchar *tracker_escape_metadata_printf (const gchar *format,
...);
/* We used to escape strings before we used DBus */
#define tracker_escape_metadata g_strdup
#define tracker_escape_metadata_printf g_strdup_printf
G_END_DECLS
......
......@@ -34,13 +34,13 @@
#include <glib.h>
#include <glib/gstdio.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
static void extract_abw (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "application/x-abiword", extract_abw },
{ NULL, NULL }
};
......@@ -113,8 +113,8 @@ extract_abw (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -28,7 +28,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#define EXIF_DATE_FORMAT "%Y:%m:%d %H:%M:%S"
......
......@@ -33,7 +33,7 @@
#include <gst/gst.h>
#include <gst/tag/tag.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-albumart.h"
typedef enum {
......
......@@ -33,7 +33,7 @@
#include <gst/tag/tag.h>
#include <gst/interfaces/tagreader.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-albumart.h"
typedef enum {
......
......@@ -64,7 +64,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-albumart.h"
/*
......
......@@ -26,7 +26,7 @@
#include <libxml/HTMLparser.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
typedef enum {
......@@ -41,7 +41,7 @@ typedef struct {
static void extract_html (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "text/html", extract_html },
{ "application/xhtml+xml", extract_html },
{ NULL, NULL }
......@@ -222,8 +222,8 @@ extract_html (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -29,7 +29,7 @@
#include <libtracker-common/tracker-os-dependant.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
static void extract_imagemagick (const gchar *filename,
......
......@@ -40,7 +40,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
#ifdef HAVE_EXEMPI
......@@ -56,7 +56,7 @@
static void extract_jpeg (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "image/jpeg", extract_jpeg },
{ NULL, NULL }
};
......@@ -356,8 +356,8 @@ extract_jpeg (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -17,11 +17,12 @@
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include <xine.h>
#include <glib.h>
#include "tracker-extract.h"
#include "tracker-main.h"
static void
add_uint32_info (GHashTable *metadata, char *key, uint32_t info)
......
......@@ -39,7 +39,7 @@
#include <sys/mman.h>
#endif /* G_OS_WIN32 */
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-albumart.h"
#include "tracker-escape.h"
......@@ -276,7 +276,7 @@ static gint freq_table[4][3] = {
{32000, 16000, 8000}
};
static TrackerExtractorData extractor_data[] = {
static TrackerExtractData extract_data[] = {
{ "audio/mpeg", extract_mp3 },
{ "audio/x-mp3", extract_mp3 },
{ NULL, NULL }
......@@ -1531,8 +1531,8 @@ extract_mp3 (const gchar *filename,
close(file);
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return extractor_data;
return extract_data;
}
......@@ -28,13 +28,13 @@
#include <libtracker-common/tracker-os-dependant.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
static void extract_mplayer (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "audio/*", extract_mplayer },
{ "video/*", extract_mplayer },
{ NULL, NULL }
......@@ -247,8 +247,8 @@ extract_mplayer (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -36,12 +36,12 @@
#include <libtracker-common/tracker-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
static void extract_msoffice (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "application/msword", extract_msoffice },
{ "application/vnd.ms-*", extract_msoffice },
{ NULL, NULL }
......@@ -222,8 +222,8 @@ extract_msoffice (const gchar *filename,
gsf_shutdown ();
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -26,7 +26,7 @@
#include <libtracker-common/tracker-os-dependant.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
typedef enum {
......@@ -63,7 +63,7 @@ static void text_handler (GMarkupParseContext *context,
static void extract_oasis (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData extractor_data[] = {
static TrackerExtractData extract_data[] = {
{ "application/vnd.oasis.opendocument.*", extract_oasis },
{ NULL, NULL }
};
......@@ -243,8 +243,8 @@ text_handler (GMarkupParseContext *context,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return extractor_data;
return extract_data;
}
......@@ -26,7 +26,7 @@
#include <glib.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
#include <libtracker-common/tracker-utils.h>
......@@ -34,7 +34,7 @@
static void extract_pdf (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "application/pdf", extract_pdf },
{ NULL, NULL }
};
......@@ -114,8 +114,8 @@ extract_pdf (const gchar *filename,
g_object_unref (document);
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -31,9 +31,10 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
#include "tracker-extract.h"
#include <totem-pl-parser.h>
#include "tracker-main.h"
#define PLAYLIST_PROPERTY_NO_TRACKS "Playlist:Songs"
#define PLAYLIST_PROPERTY_DURATION "Playlist:Duration"
#define PLAYLIST_PROPERTY_CALCULATED "Playlist:ValidDuration"
......@@ -50,7 +51,7 @@ static void extract_playlist (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "audio/x-mpegurl", extract_playlist },
{ "audio/mpegurl", extract_playlist },
{ "audio/x-scpls", extract_playlist },
......@@ -137,8 +138,8 @@ extract_playlist (const gchar *filename,
g_object_unref (pl);
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -39,7 +39,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
#include "tracker-escape.h"
......@@ -70,7 +70,7 @@ static TagProcessors tag_processors[] = {
{ NULL, NULL, NULL},
};
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "image/png", extract_png },
{ NULL, NULL }
};
......@@ -267,8 +267,8 @@ extract_png (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -37,7 +37,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-os-dependant.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
#ifndef HAVE_GETLINE
......@@ -59,7 +59,7 @@ static void extract_ps_gz (const gchar *filename,
static void extract_ps (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "application/x-gzpostscript", extract_ps_gz },
{ "application/postscript", extract_ps },
{ NULL, NULL }
......@@ -354,8 +354,8 @@ extract_ps_gz (const gchar *filename,
g_unlink (gunzipped);
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -29,7 +29,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
#define XMP_NAMESPACE_LENGTH 29
......@@ -57,7 +57,7 @@ static void extract_tiff (const gchar *filename,
GHashTable *metadata);
static gchar *date_to_iso8601 (gchar *date);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "image/tiff", extract_tiff },
{ NULL, NULL }
};
......@@ -269,8 +269,8 @@ extract_tiff (const gchar *filename,
TIFFClose (image);
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -25,7 +25,7 @@
#include <libtracker-common/tracker-os-dependant.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-escape.h"
static gchar *tags[][2] = {
......@@ -46,7 +46,7 @@ static gchar *tags[][2] = {
static void extract_totem (const gchar *filename,
GHashTable *metadata);
static TrackerExtractorData data[] = {
static TrackerExtractData data[] = {
{ "audio/*", extract_totem },
{ "video/*", extract_totem },
{ NULL, NULL }
......@@ -83,8 +83,8 @@ extract_totem (const gchar *filename,
}
}
TrackerExtractorData *
tracker_get_extractor_data (void)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
......@@ -26,9 +26,7 @@
#include <glib.h>
#include <vorbis/vorbisfile.h>
#include "tracker-extract.h"
/*#include "tracker-utils.h"*/
#include "tracker-main.h"
static struct {
char * name;
......
......@@ -21,31 +21,33 @@
#include <glib.h>
#include "tracker-extract.h"
#include "tracker-main.h"
#include "tracker-xmp.h"
#include "tracker-escape.h"
static void extract_xmp (const gchar *filename,
GHashTable *metadata);
static TrackerExtractData data[] = {
{ "application/rdf+xml", extract_xmp },
{ NULL, NULL }
};
static void
tracker_extract_xmp (const gchar* filename, GHashTable *metadata)
extract_xmp (const gchar *filename,
GHashTable *metadata)
{
gchar *contents;
gsize length;
GError *error;
if ( g_file_get_contents ( filename, &contents, &length, &error ) )
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)
TrackerExtractData *
tracker_get_extract_data (void)
{
return data;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2008, Nokia
*
* This library 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 library 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.
*