[tracker] tracker-extract: Use TrackerMimetypeInfo in commandline extraction
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract: Use TrackerMimetypeInfo in commandline extraction
- Date: Tue, 2 Aug 2011 14:02:04 +0000 (UTC)
commit c2bda56c4bed1346d88158f65f8b64b148dcf044
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Aug 2 13:28:47 2011 +0200
tracker-extract: Use TrackerMimetypeInfo in commandline extraction
This is so it falls back through different extract modules if any
of these fails to extract information, likewise to the dbus method.
src/tracker-extract/tracker-extract.c | 56 +++++++++++++++++---------------
1 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 5e2bfba..7f14870 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -704,7 +704,6 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
gchar *where;
TrackerExtractPrivate *priv;
TrackerExtractTask *task;
- TrackerExtractInitFunc init_func;
priv = TRACKER_EXTRACT_GET_PRIVATE (object);
priv->disable_summary_on_finalize = TRUE;
@@ -719,38 +718,43 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
return;
}
- task->cur_module = tracker_extract_module_manager_get_for_mimetype (task->mimetype, &init_func, NULL, &task->cur_func);
+ task->mimetype_handlers = tracker_extract_module_manager_get_mimetype_handlers (task->mimetype);
+ task->cur_module = tracker_mimetype_info_get_module (task->mimetype_handlers, &task->cur_func, NULL);
- if (init_func) {
- TrackerModuleThreadAwareness ignore;
+ while (task->cur_module && task->cur_func) {
+ if (get_file_metadata (task, &preupdate, &statements, &where)) {
+ const gchar *preupdate_str, *statements_str;
- /* Initialize module for this single run */
- (init_func) (&ignore, NULL);
- }
-
- if (get_file_metadata (task, &preupdate, &statements, &where)) {
- const gchar *preupdate_str, *statements_str;
+ preupdate_str = statements_str = NULL;
- preupdate_str = statements_str = NULL;
+ if (tracker_sparql_builder_get_length (statements) > 0) {
+ statements_str = tracker_sparql_builder_get_result (statements);
+ }
- if (tracker_sparql_builder_get_length (statements) > 0) {
- statements_str = tracker_sparql_builder_get_result (statements);
- }
+ if (tracker_sparql_builder_get_length (preupdate) > 0) {
+ preupdate_str = tracker_sparql_builder_get_result (preupdate);
+ }
- if (tracker_sparql_builder_get_length (preupdate) > 0) {
- preupdate_str = tracker_sparql_builder_get_result (preupdate);
- }
+ g_print ("SPARQL pre-update:\n%s\n",
+ preupdate_str ? preupdate_str : "");
+ g_print ("SPARQL item:\n%s\n",
+ statements_str ? statements_str : "");
+ g_print ("SPARQL where clause:\n%s\n",
+ where ? where : "");
- g_print ("SPARQL pre-update:\n%s\n",
- preupdate_str ? preupdate_str : "");
- g_print ("SPARQL item:\n%s\n",
- statements_str ? statements_str : "");
- g_print ("SPARQL where clause:\n%s\n",
- where ? where : "");
+ g_object_unref (statements);
+ g_object_unref (preupdate);
+ g_free (where);
+ break;
+ } else {
+ if (!tracker_mimetype_info_iter_next (task->mimetype_handlers)) {
+ break;
+ }
- g_object_unref (statements);
- g_object_unref (preupdate);
- g_free (where);
+ task->cur_module = tracker_mimetype_info_get_module (task->mimetype_handlers,
+ &task->cur_func,
+ NULL);
+ }
}
extract_task_free (task);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]