tracker r2219 - in branches/indexer-split: . src/tracker-extract
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2219 - in branches/indexer-split: . src/tracker-extract
- Date: Thu, 11 Sep 2008 13:51:10 +0000 (UTC)
Author: mr
Date: Thu Sep 11 13:51:09 2008
New Revision: 2219
URL: http://svn.gnome.org/viewvc/tracker?rev=2219&view=rev
Log:
* src/tracker-extract/tracker-extract-imagemagick.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-totem.c:
* src/tracker-extract/tracker-extract.[ch]: Code clean up and use
libtracker-common for functions instead of duplicating them in
these files.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-extract/tracker-extract-imagemagick.c
branches/indexer-split/src/tracker-extract/tracker-extract-mplayer.c
branches/indexer-split/src/tracker-extract/tracker-extract-msoffice.c
branches/indexer-split/src/tracker-extract/tracker-extract-oasis.c
branches/indexer-split/src/tracker-extract/tracker-extract-pdf.c
branches/indexer-split/src/tracker-extract/tracker-extract-totem.c
branches/indexer-split/src/tracker-extract/tracker-extract.c
branches/indexer-split/src/tracker-extract/tracker-extract.h
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-imagemagick.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-imagemagick.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-imagemagick.c Thu Sep 11 13:51:09 2008
@@ -1,5 +1,7 @@
-/* Tracker Extract - extracts embedded metadata from files
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
@@ -22,12 +24,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+
#include <glib.h>
+#include <libtracker-common/tracker-os-dependant.h>
+
#include "tracker-extract.h"
#include "tracker-xmp.h"
-
static void
tracker_extract_imagemagick (const gchar *filename, GHashTable *metadata)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-mplayer.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-mplayer.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-mplayer.c Thu Sep 11 13:51:09 2008
@@ -1,6 +1,8 @@
-/* Tracker - audio/video metadata extraction that will call MPlayer
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Edward Duffy (eduffy gmail com)
* Copyright (C) 2006, Laurent Aguerreche (laurent aguerreche free fr)
+ * 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
@@ -18,10 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
+#include "config.h"
+
#include <string.h>
+
#include <glib.h>
+
+#include <libtracker-common/tracker-os-dependant.h>
+
#include "tracker-extract.h"
+static void extract_mplayer (const gchar *filename,
+ GHashTable *metadata);
+
+static TrackerExtractorData data[] = {
+ { "audio/*", extract_mplayer },
+ { "video/*", extract_mplayer },
+ { NULL, NULL }
+};
static gchar *video_tags[][2] = {
{ "ID_VIDEO_HEIGHT", "Video:Height" },
@@ -32,7 +48,6 @@
{ NULL, NULL }
};
-
static gchar *audio_tags[][2] = {
{ "ID_AUDIO_BITRATE", "Audio:Bitrate" },
{ "ID_AUDIO_RATE", "Audio:Samplerate" },
@@ -41,7 +56,6 @@
{ NULL, NULL }
};
-
/* Some of "info_tags" tags can belong to Audio or/and video or none, so 3 cases :
* 1/ tag does not belong to audio nor video, it is a general tag ;
* 2/ tag only belongs to audio ;
@@ -60,16 +74,19 @@
{ NULL, NULL, NULL }
};
-
static void
-copy_hash_table_entry (gpointer key, gpointer value, gpointer user_data)
+copy_hash_table_entry (gpointer key,
+ gpointer value,
+ gpointer user_data)
{
- g_hash_table_insert ((GHashTable *) user_data, g_strdup ((char *) key), g_strdup ((char *) value));
+ g_hash_table_insert (user_data,
+ g_strdup (key),
+ g_strdup (value));
}
-
static void
-tracker_extract_mplayer (const gchar *filename, GHashTable *metadata)
+extract_mplayer (const gchar *filename,
+ GHashTable *metadata)
{
gchar *argv[10];
gchar *mplayer;
@@ -86,12 +103,17 @@
argv[9] = NULL;
if (tracker_spawn (argv, 10, &mplayer, NULL)) {
-
- GPatternSpec *pattern_ID_AUDIO_ID, *pattern_ID_VIDEO_ID;
- GPatternSpec *pattern_ID_AUDIO, *pattern_ID_VIDEO, *pattern_ID_CLIP_INFO_NAME, *pattern_ID_CLIP_INFO_VALUE, *pattern_ID_LENGTH;
- GHashTable *tmp_metadata_audio, *tmp_metadata_video;
- gboolean has_audio, has_video;
- gchar *duration;
+ GPatternSpec *pattern_ID_AUDIO_ID;
+ GPatternSpec *pattern_ID_VIDEO_ID;
+ GPatternSpec *pattern_ID_AUDIO;
+ GPatternSpec *pattern_ID_VIDEO;
+ GPatternSpec *pattern_ID_CLIP_INFO_NAME;
+ GPatternSpec *pattern_ID_CLIP_INFO_VALUE;
+ GPatternSpec *pattern_ID_LENGTH;
+ GHashTable *tmp_metadata_audio;
+ GHashTable *tmp_metadata_video;
+ gboolean has_audio, has_video;
+ gchar *duration;
gchar **lines, **line;
pattern_ID_AUDIO_ID = g_pattern_spec_new ("ID_AUDIO_ID=*");
@@ -111,16 +133,12 @@
lines = g_strsplit (mplayer, "\n", -1);
-
for (line = lines; *line; ++line) {
-
if (g_pattern_match_string (pattern_ID_AUDIO_ID, *line)) {
- /* media has audio! */
has_audio = TRUE;
}
else if (g_pattern_match_string (pattern_ID_VIDEO_ID, *line)) {
- /* media has video! */
has_video = TRUE;
}
@@ -228,14 +246,6 @@
}
}
-
-TrackerExtractorData data[] = {
- { "audio/*", tracker_extract_mplayer },
- { "video/*", tracker_extract_mplayer },
- { NULL, NULL }
-};
-
-
TrackerExtractorData *
tracker_get_extractor_data (void)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-msoffice.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-msoffice.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-msoffice.c Thu Sep 11 13:51:09 2008
@@ -1,6 +1,8 @@
-/* Tracker - metadata extraction of Word files with libgsf
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Edward Duffy (eduffy gmail com)
* Copyright (C) 2006, Laurent Aguerreche (laurent aguerreche free fr)
+ * 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
@@ -19,10 +21,11 @@
*/
#include "config.h"
-#include "tracker-extract.h"
#include <string.h>
+
#include <glib.h>
+
#include <gsf/gsf.h>
#include <gsf/gsf-doc-meta-data.h>
#include <gsf/gsf-infile.h>
@@ -31,11 +34,26 @@
#include <gsf/gsf-msole-utils.h>
#include <gsf/gsf-utils.h>
+#include <libtracker-common/tracker-utils.h>
+
+#include "tracker-extract.h"
+
+static void extract_msoffice (const gchar *filename,
+ GHashTable *metadata);
+
+static TrackerExtractorData data[] = {
+ { "application/msword", extract_msoffice },
+ { "application/vnd.ms-*", extract_msoffice },
+ { NULL, NULL }
+};
static void
-add_gvalue_in_hash_table (GHashTable *table, const gchar *key, GValue const *val)
+add_gvalue_in_hash_table (GHashTable *table,
+ const gchar *key,
+ GValue const *val)
{
- g_return_if_fail (table && key);
+ g_return_if_fail (table != NULL);
+ g_return_if_fail (key != NULL);
if (val) {
gchar *s = g_strdup_value_contents (val);
@@ -44,7 +62,10 @@
if (!tracker_is_empty_string (s)) {
gchar *str_val;
- /* Some fun: strings are always written "str" with double quotes around, but not numbers! */
+ /* Some fun: strings are always
+ * written "str" with double quotes
+ * around, but not numbers!
+ */
if (s[0] == '"') {
size_t len;
@@ -53,12 +74,19 @@
if (s[len - 1] == '"') {
str_val = (len > 2 ? g_strndup (s + 1, len - 2) : NULL);
} else {
- /* We have a string that begins with a double quote but which finishes
- by something different... We copy the string from the beginning. */
+ /* We have a string
+ * that begins with a
+ * double quote but
+ * which finishes by
+ * something different...
+ * We copy the string
+ * from the
+ * beginning.
+ */
str_val = g_strdup (s);
}
} else {
- /* here, we probably have a number */
+ /* Here, we probably have a number */
str_val = g_strdup (s);
}
@@ -72,61 +100,65 @@
}
}
-
static void
-metadata_cb (gpointer key, gpointer value, gpointer user_data)
+metadata_cb (gpointer key,
+ gpointer value,
+ gpointer user_data)
{
- gchar *name = key;
- GsfDocProp *property = value;
- GHashTable *metadata = user_data;
- GValue const *val = gsf_doc_prop_get_val (property);
+ gchar *name;
+ GsfDocProp *property;
+ GHashTable *metadata;
+ GValue const *val;
+
+ name = key;
+ property = value;
+ metadata = user_data;
+ val = gsf_doc_prop_get_val (property);
if (strcmp (name, "dc:title") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Title", val);
-
} else if (strcmp (name, "dc:subject") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Subject", val);
-
} else if (strcmp (name, "dc:creator") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Author", val);
-
} else if (strcmp (name, "dc:keywords") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Keywords", val);
-
} else if (strcmp (name, "dc:description") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Comments", val);
-
} else if (strcmp (name, "gsf:page-count") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:PageCount", val);
-
} else if (strcmp (name, "gsf:word-count") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:WordCount", val);
-
} else if (strcmp (name, "meta:creation-date") == 0) {
add_gvalue_in_hash_table (metadata, "Doc:Created", val);
-
} else if (strcmp (name, "meta:generator") == 0) {
add_gvalue_in_hash_table (metadata, "File:Other", val);
}
}
-
static void
-doc_metadata_cb (gpointer key, gpointer value, gpointer user_data)
+doc_metadata_cb (gpointer key,
+ gpointer value,
+ gpointer user_data)
{
- gchar *name = key;
- GsfDocProp *property = value;
- GHashTable *metadata = user_data;
- GValue const *val = gsf_doc_prop_get_val (property);
+ gchar *name;
+ GsfDocProp *property;
+ GHashTable *metadata;
+ GValue const *val;
+
+ name = key;
+ property = value;
+ metadata = user_data;
+ val = gsf_doc_prop_get_val (property);
if (strcmp (name, "CreativeCommons_LicenseURL") == 0) {
add_gvalue_in_hash_table (metadata, "File:License", val);
}
}
-
static void
-tracker_extract_msoffice (const gchar *filename, GHashTable *metadata)
+extract_msoffice (const gchar *filename,
+ GHashTable *metadata)
{
GsfInput *input;
GsfInfile *infile;
@@ -188,14 +220,6 @@
gsf_shutdown ();
}
-
-TrackerExtractorData data[] = {
- { "application/msword", tracker_extract_msoffice },
- { "application/vnd.ms-*", tracker_extract_msoffice },
- { NULL, NULL }
-};
-
-
TrackerExtractorData *
tracker_get_extractor_data (void)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-oasis.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-oasis.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-oasis.c Thu Sep 11 13:51:09 2008
@@ -1,5 +1,7 @@
-/* Tracker Extract - extracts embedded metadata from files
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
@@ -19,52 +21,62 @@
#include <stdio.h>
#include <string.h>
+
#include <glib.h>
+
+#include <libtracker-common/tracker-os-dependant.h>
+
#include "tracker-extract.h"
typedef enum {
- READ_TITLE,
- READ_SUBJECT,
- READ_AUTHOR,
- READ_KEYWORDS,
- READ_COMMENTS,
- READ_STATS,
- READ_CREATED,
- READ_FILE_OTHER
- } tag_type;
-
+ READ_TITLE,
+ READ_SUBJECT,
+ READ_AUTHOR,
+ READ_KEYWORDS,
+ READ_COMMENTS,
+ READ_STATS,
+ READ_CREATED,
+ READ_FILE_OTHER
+} tag_type;
typedef struct {
GHashTable *metadata;
tag_type current;
} ODTParseInfo;
+static void start_element_handler (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+static void end_element_handler (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+static void text_handler (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+static void extract_oasis (const gchar *filename,
+ GHashTable *metadata);
-static void start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error);
-
-static void end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error);
-
-static void text_handler (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error);
-
+static TrackerExtractorData data[] = {
+ { "application/vnd.oasis.opendocument.*", extract_oasis },
+ { NULL, NULL }
+};
static void
-tracker_extract_oasis (const gchar *filename, GHashTable *metadata)
+extract_oasis (const gchar *filename,
+ GHashTable *metadata)
{
gchar *argv[5];
gchar *xml;
- ODTParseInfo info = { metadata, -1 };
+ ODTParseInfo info = {
+ metadata,
+ -1
+ };
argv[0] = g_strdup ("unzip");
argv[1] = g_strdup ("-p");
@@ -73,15 +85,14 @@
argv[4] = NULL;
if (tracker_spawn (argv, 10, &xml, NULL)) {
-
- GMarkupParseContext *context;
- GMarkupParser parser = {
- start_element_handler,
- end_element_handler,
- text_handler,
- NULL,
- NULL
- };
+ GMarkupParseContext *context;
+ GMarkupParser parser = {
+ start_element_handler,
+ end_element_handler,
+ text_handler,
+ NULL,
+ NULL
+ };
context = g_markup_parse_context_new (&parser, 0, &info, NULL);
g_markup_parse_context_parse (context, xml, -1, NULL);
@@ -96,13 +107,13 @@
g_free (argv[0]);
}
-
-void start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
+void
+start_element_handler (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
{
ODTParseInfo *data = user_data;
@@ -122,19 +133,24 @@
data->current = READ_COMMENTS;
}
else if (strcmp (element_name, "meta:document-statistic") == 0) {
- GHashTable *metadata = data->metadata;
+ GHashTable *metadata;
const gchar **a, **v;
+ metadata = data->metadata;
+
for (a = attribute_names, v = attribute_values; *a; ++a, ++v) {
if (strcmp (*a, "meta:word-count") == 0) {
g_hash_table_insert (metadata,
- g_strdup ("Doc:WordCount"), g_strdup (*v));
+ g_strdup ("Doc:WordCount"),
+ g_strdup (*v));
}
else if (strcmp (*a, "meta:page-count") == 0) {
g_hash_table_insert (metadata,
- g_strdup ("Doc:PageCount"), g_strdup (*v));
+ g_strdup ("Doc:PageCount"),
+ g_strdup (*v));
}
}
+
data->current = READ_STATS;
}
else if (strcmp (element_name, "meta:creation-date") == 0) {
@@ -148,67 +164,79 @@
}
}
-
-void end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
+void
+end_element_handler (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
{
- ((ODTParseInfo *)user_data)->current = -1;
+ ((ODTParseInfo*) user_data)->current = -1;
}
-
-void text_handler (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error)
+void
+text_handler (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
{
- ODTParseInfo *data = user_data;
- GHashTable *metadata = data->metadata;
+ ODTParseInfo *data;
+ GHashTable *metadata;
- switch (data->current) {
- case READ_TITLE:
- g_hash_table_insert (metadata, g_strdup ("Doc:Title"), g_strdup (text));
- break;
- case READ_SUBJECT:
- g_hash_table_insert (metadata, g_strdup ("Doc:Subject"), g_strdup (text));
- break;
- case READ_AUTHOR:
- g_hash_table_insert (metadata, g_strdup ("Doc:Author"), g_strdup (text));
- break;
- case READ_KEYWORDS: {
- gchar *keywords;
- if ((keywords = g_hash_table_lookup (metadata, "Doc:Keywords"))) {
- g_hash_table_replace (metadata, g_strdup ("Doc:Keywords"),
- g_strconcat (keywords, ",", text, NULL));
- } else {
- g_hash_table_insert (metadata, g_strdup ("Doc:Keywords"), g_strdup (text));
- }
- }
- break;
- case READ_COMMENTS:
- g_hash_table_insert (metadata, g_strdup ("Doc:Comments"), g_strdup (text));
- break;
- case READ_CREATED:
- g_hash_table_insert (metadata, g_strdup ("Doc:Created"), g_strdup (text));
- break;
- case READ_FILE_OTHER:
- g_hash_table_insert (metadata, g_strdup ("File:Other"), g_strdup (text));
- break;
+ data = user_data;
+ metadata = data->metadata;
- default:
- break;
+ switch (data->current) {
+ case READ_TITLE:
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Title"),
+ g_strdup (text));
+ break;
+ case READ_SUBJECT:
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Subject"),
+ g_strdup (text));
+ break;
+ case READ_AUTHOR:
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Author"),
+ g_strdup (text));
+ break;
+ case READ_KEYWORDS: {
+ gchar *keywords;
+
+ if ((keywords = g_hash_table_lookup (metadata, "Doc:Keywords"))) {
+ g_hash_table_replace (metadata,
+ g_strdup ("Doc:Keywords"),
+ g_strconcat (keywords, ",", text, NULL));
+ } else {
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Keywords"),
+ g_strdup (text));
+ }
+ }
+ break;
+ case READ_COMMENTS:
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Comments"),
+ g_strdup (text));
+ break;
+ case READ_CREATED:
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Created"),
+ g_strdup (text));
+ break;
+ case READ_FILE_OTHER:
+ g_hash_table_insert (metadata,
+ g_strdup ("File:Other"),
+ g_strdup (text));
+ break;
+
+ default:
+ break;
}
}
-
-TrackerExtractorData data[] = {
- { "application/vnd.oasis.opendocument.*", tracker_extract_oasis },
- { NULL, NULL }
-};
-
-
TrackerExtractorData *
tracker_get_extractor_data (void)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-pdf.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-pdf.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-pdf.c Thu Sep 11 13:51:09 2008
@@ -1,6 +1,7 @@
-/* vim: set noet ts=8 sw=8 sts=0: */
-/* Tracker Extract - extracts embedded metadata from files
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
@@ -20,16 +21,27 @@
#include "config.h"
-#include <poppler.h>
#include <string.h>
+#include <poppler.h>
+
#include <glib.h>
#include "tracker-extract.h"
#include "tracker-xmp.h"
+#include <libtracker-common/tracker-utils.h>
+
+static void extract_pdf (const gchar *filename,
+ GHashTable *metadata);
+
+static TrackerExtractorData data[] = {
+ { "application/pdf", extract_pdf },
+ { NULL, NULL }
+};
static void
-tracker_extract_pdf (const gchar *filename, GHashTable *metadata)
+extract_pdf (const gchar *filename,
+ GHashTable *metadata)
{
PopplerDocument *document;
gchar *tmp;
@@ -65,27 +77,29 @@
}
if (!tracker_is_empty_string (title)) {
- g_hash_table_insert (metadata, g_strdup ("Doc:Title"), g_strdup (title));
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Title"),
+ g_strdup (title));
}
if (!tracker_is_empty_string (author)) {
- g_hash_table_insert (metadata, g_strdup ("Doc:Author"), g_strdup (author));
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Author"),
+ g_strdup (author));
}
if (!tracker_is_empty_string (subject)) {
- g_hash_table_insert (metadata, g_strdup ("Doc:Subject"), g_strdup (subject));
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Subject"),
+ g_strdup (subject));
}
if (!tracker_is_empty_string (keywords)) {
- g_hash_table_insert (metadata, g_strdup ("Doc:Keywords"), g_strdup (keywords));
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:Keywords"),
+ g_strdup (keywords));
}
-
-#if 0
- GTimeVal creation_date_val = { creation_date, 0 };
- g_hash_table_insert (metadata, g_strdup ("Doc.Created"),
- g_time_val_to_iso8601 (creation_date_val));
-#endif
-
- g_hash_table_insert (metadata, g_strdup ("Doc:PageCount"),
- g_strdup_printf ("%d", poppler_document_get_n_pages (document)));
+ g_hash_table_insert (metadata,
+ g_strdup ("Doc:PageCount"),
+ g_strdup_printf ("%d", poppler_document_get_n_pages (document)));
if ( metadata_xml ) {
tracker_read_xmp (metadata_xml, strlen (metadata_xml), metadata);
@@ -100,13 +114,6 @@
g_object_unref (document);
}
-
-TrackerExtractorData data[] = {
- { "application/pdf", tracker_extract_pdf },
- { NULL, NULL }
-};
-
-
TrackerExtractorData *
tracker_get_extractor_data (void)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-totem.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-totem.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-totem.c Thu Sep 11 13:51:09 2008
@@ -1,5 +1,7 @@
-/* Tracker - audio/video metadata extraction that will call Totem
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Edward Duffy (eduffy 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
@@ -18,7 +20,11 @@
*/
#include <string.h>
+
#include <glib.h>
+
+#include <libtracker-common/tracker-os-dependant.h>
+
#include "tracker-extract.h"
static gchar *tags[][2] = {
@@ -29,10 +35,6 @@
{ "TOTEM_INFO_VIDEO_BITRATE", "Video:Bitrate" },
{ "TOTEM_INFO_TITLE", "Video:Title" },
{ "TOTEM_INFO_AUTHOR", "Video:Author" },
- // { "TOTEM_INFO_YEAR", ...
- // { "TOTEM_INFO_ALBUM", ...
- // { "TOTEM_INFO_DURATION", ...
- // { "TOTEM_INFO_TRACK_NUMBER", ...
{ "TOTEM_INFO_AUDIO_BITRATE", "Audio:Bitrate" },
{ "TOTEM_INFO_AUDIO_SAMPLE_RATE", "Audio:Samplerate" },
{ "TOTEM_INFO_AUDIO_CODEC", "Audio:Codec" },
@@ -40,9 +42,18 @@
{ NULL, NULL }
};
+static void extract_totem (const gchar *filename,
+ GHashTable *metadata);
+
+static TrackerExtractorData data[] = {
+ { "audio/*", extract_totem },
+ { "video/*", extract_totem },
+ { NULL, NULL }
+};
static void
-tracker_extract_totem (const gchar *filename, GHashTable *metadata)
+extract_totem (const gchar *filename,
+ GHashTable *metadata)
{
gchar *argv[3];
gchar *totem;
@@ -52,7 +63,6 @@
argv[2] = NULL;
if (tracker_spawn (argv, 10, &totem, NULL)) {
-
gchar **lines, **line;
lines = g_strsplit (totem, "\n", -1);
@@ -72,14 +82,6 @@
}
}
-
-TrackerExtractorData data[] = {
- { "audio/*", tracker_extract_totem },
- { "video/*", tracker_extract_totem },
- { NULL, NULL }
-};
-
-
TrackerExtractorData *
tracker_get_extractor_data (void)
{
Modified: branches/indexer-split/src/tracker-extract/tracker-extract.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract.c Thu Sep 11 13:51:09 2008
@@ -1,6 +1,7 @@
-/* vim: set noet ts=8 sw=8 sts=0: */
-/* Tracker Extract - extracts embedded metadata from files
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
Modified: branches/indexer-split/src/tracker-extract/tracker-extract.h
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract.h (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract.h Thu Sep 11 13:51:09 2008
@@ -1,5 +1,7 @@
-/* Tracker Extract - extracts embedded metadata from files
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
@@ -25,6 +27,7 @@
G_BEGIN_DECLS
typedef struct TrackerExtractorData TrackerExtractorData;
+
typedef TrackerExtractorData * (* TrackerExtractorDataFunc) (void);
struct TrackerExtractorData {
@@ -36,11 +39,6 @@
gchar * tracker_generic_date_to_iso8601 (const gchar *date,
const gchar *format);
-gboolean tracker_is_empty_string (const gchar *s);
-gboolean tracker_spawn (gchar **argv,
- int timeout,
- gchar **tmp_stdout,
- gint *exit_status);
TrackerExtractorData *tracker_get_extractor_data (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]