[tracker/tracker-0.10] tracker-extract: Provide clear logging about which extractor module is used



commit 4e2e498375410addf3ee6b2cc257a289b7c8ab48
Author: Martyn Russell <martyn lanedo com>
Date:   Wed May 25 15:49:16 2011 +0100

    tracker-extract: Provide clear logging about which extractor module is used
    
    This is a bit of a regression, we used to say which extractor module was used
    but we don't for some reason in master. This fixes that.

 src/tracker-extract/tracker-extract.c |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 4755eb0..35c06e8 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -411,6 +411,9 @@ get_file_metadata (TrackerExtract         *extract,
 #ifdef HAVE_LIBSTREAMANALYZER
 	gchar *content_type = NULL;
 #endif
+	gint items;
+
+	g_debug ("Extracting...");
 
 	priv = TRACKER_EXTRACT_GET_PRIVATE (extract);
 
@@ -423,7 +426,7 @@ get_file_metadata (TrackerExtract         *extract,
 
 #ifdef HAVE_LIBSTREAMANALYZER
 	if (!priv->force_internal_extractors) {
-		g_message ("  Extracting with libstreamanalyzer...");
+		g_debug ("  Using libstreamanalyzer...");
 
 		tracker_topanalyzer_extract (uri, statements, &content_type);
 
@@ -436,7 +439,7 @@ get_file_metadata (TrackerExtract         *extract,
 			return TRUE;
 		}
 	} else {
-		g_message ("  Extracting with internal extractors ONLY...");
+		g_debug ("  Using internal extractors ONLY...");
 	}
 #endif /* HAVE_LIBSTREAMANALYZER */
 
@@ -519,6 +522,9 @@ get_file_metadata (TrackerExtract         *extract,
 			if (g_pattern_match (mdata->pattern, length, mime_used, reversed)) {
 				gint items;
 
+				g_debug ("  Using %s... (specific match)", 
+				         g_module_name ((GModule*) mdata->module));
+
 				(*edata->func) (uri, preupdate, statements);
 
 				items = tracker_sparql_builder_get_length (statements);
@@ -537,6 +543,9 @@ get_file_metadata (TrackerExtract         *extract,
 
 				*preupdate_out = preupdate;
 				*statements_out = statements;
+
+				g_debug ("Done (%d items)", items);
+
 				return TRUE;
 			}
 		}
@@ -551,15 +560,13 @@ get_file_metadata (TrackerExtract         *extract,
 			if (g_pattern_match (mdata->pattern, length, mime_used, reversed)) {
 				gint items;
 
-				g_message ("  Extracting with module:'%s'",
-				           g_module_name ((GModule*) mdata->module));
+				g_debug ("  Using %s... (generic match)", 
+				         g_module_name ((GModule*) mdata->module));
 
 				(*edata->func) (uri, preupdate, statements);
 
 				items = tracker_sparql_builder_get_length (statements);
 
-				g_message ("  Found %d metadata items", items);
-
 				mdata->extracted_count++;
 
 				if (items == 0) {
@@ -575,21 +582,30 @@ get_file_metadata (TrackerExtract         *extract,
 				*preupdate_out = preupdate;
 				*statements_out = statements;
 
+				g_debug ("Done (%d items)", items);
+
 				return TRUE;
 			}
 		}
 
+		g_debug ("  No extractor was available for this mime type:'%s'",
+		         mime_used);
+
 		g_free (mime_used);
 		g_free (reversed);
 	}
 
-	if (tracker_sparql_builder_get_length (statements) > 0) {
+	items = tracker_sparql_builder_get_length (statements);
+
+	if (items > 0) {
 		tracker_sparql_builder_insert_close (statements);
 	}
 
 	*preupdate_out = preupdate;
 	*statements_out = statements;
 
+	g_debug ("No extractor or failed (%d items)", items);
+
 	return TRUE;
 }
 
@@ -724,8 +740,6 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
 
 	g_return_if_fail (uri != NULL);
 
-	g_message ("Extracting...");
-
 	if (get_file_metadata (object, uri, mime, &preupdate, &statements)) {
 		const gchar *preupdate_str, *statements_str;
 



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