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



Author: ifrade
Date: Sun Oct  5 21:25:25 2008
New Revision: 2311
URL: http://svn.gnome.org/viewvc/tracker?rev=2311&view=rev

Log:
Added dummy extractor to use as example

Added:
   trunk/src/tracker-extract/dummy.c
Modified:
   trunk/ChangeLog

Added: trunk/src/tracker-extract/dummy.c
==============================================================================
--- (empty file)
+++ trunk/src/tracker-extract/dummy.c	Sun Oct  5 21:25:25 2008
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007, 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
+ * 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"
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include "tracker-extract.h"
+
+/*
+ * Prototype of the parsing function. 
+ */
+static void extract_dummy (const gchar *filename,
+			   GHashTable  *metadata);
+
+/*
+ * Link between mimetype and parsing function
+ */
+static TrackerExtractorData data[] = {
+	{ "mimetype/x-dummy", extract_dummy },
+	{ NULL, NULL }
+};
+
+/*
+ * Implementation of the parsing function
+ */
+static void
+extract_function (const gchar *filename,
+		  GHashTable  *metadata)
+{
+
+	/*
+	 * Open the file and do whatever you need to do with it.
+	 *
+	 * The extracted properties must be added to the metadata
+	 * hash table. 
+	 */
+	g_hash_table_insert (metadata,
+			     g_strdup ("Dummy:DummyProp"),
+			     g_strdup ("Value"));
+}
+
+/*
+ * Dont touch this function! Keep it in your module with this exact name.
+ * It is the "public" function used to load the module.
+ */
+TrackerExtractorData *
+tracker_get_extractor_data (void)
+{
+	return data;
+}



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