tracker r2348 - in trunk: . src/tracker-extract
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2348 - in trunk: . src/tracker-extract
- Date: Thu, 9 Oct 2008 14:23:55 +0000 (UTC)
Author: mr
Date: Thu Oct 9 14:23:54 2008
New Revision: 2348
URL: http://svn.gnome.org/viewvc/tracker?rev=2348&view=rev
Log:
* src/tracker-extract/Makefile.am: Put all definitions and
includes before CFLAGS (like everywhere else). Fix linking order.
* src/tracker-extract/tracker-extract.c: Don't call g_strstrip()
on NULL values, check the mime type first since it can be NULL.
Fixes a warning that was being produced. Also added GOption
support so users can do --help to see how to use the extractor
from the terminal.
Modified:
trunk/ChangeLog
trunk/src/tracker-extract/Makefile.am
trunk/src/tracker-extract/tracker-extract.c
Modified: trunk/src/tracker-extract/Makefile.am
==============================================================================
--- trunk/src/tracker-extract/Makefile.am (original)
+++ trunk/src/tracker-extract/Makefile.am Thu Oct 9 14:23:54 2008
@@ -4,8 +4,10 @@
modulesdir = $(libdir)/tracker/extract-modules
INCLUDES = \
- $(GLIB2_CFLAGS) \
- $(GMODULE_CFLAGS) \
+ -DLOCALEDIR=\""$(localedir)"\" \
+ -DMODULESDIR=\"$(modulesdir)\" \
+ -DTRACKER_COMPILATION \
+ -I$(top_srcdir)/src \
$(EXEMPI_CFLAGS) \
$(LIBJPEG_CFLAGS) \
$(LIBTIFF_CFLAGS) \
@@ -17,9 +19,8 @@
$(GSTREAMER_CFLAGS) \
$(XINE_CFLAGS) \
$(GDKPIXBUF_CFLAGS) \
- -I$(top_srcdir)/src \
- -DMODULES_DIR=\"$(modulesdir)\" \
- -DTRACKER_COMPILATION
+ $(GMODULE_CFLAGS) \
+ $(GLIB2_CFLAGS)
modules_LTLIBRARIES = \
libextract-abw.la \
Modified: trunk/src/tracker-extract/tracker-extract.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract.c (original)
+++ trunk/src/tracker-extract/tracker-extract.c Thu Oct 9 14:23:54 2008
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <glib.h>
+#include <glib/gi18n.h>
#include <gmodule.h>
#ifndef G_OS_WIN32
@@ -144,7 +145,7 @@
sizeof (TrackerExtractorData),
10);
- dir = g_dir_open (MODULES_DIR, 0, &error);
+ dir = g_dir_open (MODULESDIR, 0, &error);
if (!dir) {
g_error ("Error opening modules directory: %s", error->message);
@@ -165,7 +166,7 @@
continue;
}
- module_path = g_build_filename (MODULES_DIR, name, NULL);
+ module_path = g_build_filename (MODULESDIR, name, NULL);
module = g_module_open (module_path, G_MODULE_BIND_LOCAL);
@@ -345,6 +346,8 @@
* knows when to stop reading
*/
g_print ("\n");
+
+ debug ("Extractor - Waiting for work");
}
static gboolean
@@ -362,7 +365,10 @@
g_io_channel_read_line (channel, &mimetype, NULL, NULL, NULL);
g_strstrip (filename);
- g_strstrip (mimetype);
+
+ if (mimetype) {
+ g_strstrip (mimetype);
+ }
print_file_metadata (filename, mimetype);
@@ -375,8 +381,44 @@
int
main (int argc, char *argv[])
{
- GMainLoop *main_loop;
- GIOChannel *input;
+ GOptionContext *context;
+ GMainLoop *main_loop;
+ GIOChannel *input;
+ gchar *summary;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ /* Translators: this messagge will apper immediately after the */
+ /* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE> */
+ context = g_option_context_new (_("- Extract file meta data"));
+
+ /* Translators: this message will appear after the usage string */
+ /* and before the list of options. */
+ summary = g_strconcat (_("Given the following format (without quotes):"),
+ "\n",
+ "\n",
+ " '[filename]\\n[mime-type]'\n",
+ "\n",
+ _("This is interpreted from STDIN and then processed."),
+ "\n",
+ "\n",
+ _("If this command is run without any arguments, "
+ "it will wait for work to do."),
+ "\n",
+ "\n",
+ _("Here are some examples of how to use this command:"),
+ "\n",
+ "\n",
+ " echo -e \"/home/foo/bar/baz.mp3\\naudio/x-mpeg\" | tracker-extract",
+ NULL);
+
+ g_option_context_set_summary (context, summary);
+ g_option_context_parse (context, &argc, &argv, NULL);
+ g_option_context_free (context);
+
+ g_free (summary);
debug ("Extractor - Initializing...");
tracker_memory_setrlimits ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]