[tracker/wip/extract-graphs: 24/30] tracker-extract, mplayer: Do all inserts in miner-fs's graph



commit af29d591e0660c9cd81481dab51d3df854e99c00
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Sep 6 10:43:24 2011 +0200

    tracker-extract, mplayer: Do all inserts in miner-fs's graph

 src/tracker-extract/tracker-extract-mplayer.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mplayer.c b/src/tracker-extract/tracker-extract-mplayer.c
index aa724c5..16c359a 100644
--- a/src/tracker-extract/tracker-extract-mplayer.c
+++ b/src/tracker-extract/tracker-extract-mplayer.c
@@ -69,6 +69,7 @@ static const gchar *info_tags[][2] = {
 typedef struct {
 	TrackerSparqlBuilder *preupdate;
 	TrackerSparqlBuilder *metadata;
+	const gchar *graph;
 } ForeachCopyInfo;
 
 static void
@@ -82,6 +83,9 @@ copy_hash_table_entry (gpointer key,
 		gchar *canonical_uri = tracker_sparql_escape_uri_printf ("urn:artist:%s", value);
 
 		tracker_sparql_builder_insert_open (info->preupdate, NULL);
+		if (info->graph) {
+			tracker_sparql_builder_graph_open (info->preupdate, info->graph);
+		}
 
 		tracker_sparql_builder_subject_iri (info->preupdate, canonical_uri);
 		tracker_sparql_builder_predicate (info->preupdate, "a");
@@ -90,6 +94,9 @@ copy_hash_table_entry (gpointer key,
 		tracker_sparql_builder_predicate (info->preupdate, "nmm:artistName");
 		tracker_sparql_builder_object_unvalidated (info->preupdate, value);
 
+		if (info->graph) {
+			tracker_sparql_builder_graph_open (info->preupdate, info->graph);
+		}
 		tracker_sparql_builder_insert_close (info->preupdate);
 
 		g_free (canonical_uri);
@@ -106,10 +113,12 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 	GFile *file;
 	gchar *argv[10];
 	gchar *mplayer;
+	const gchar *graph;
 
 	file = tracker_extract_info_get_file (info);
 	metadata = tracker_extract_info_get_metadata_builder (info);
 	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	graph = tracker_extract_info_get_graph (info);
 
 	argv[0] = g_strdup ("mplayer");
 	argv[1] = g_strdup ("-identify");
@@ -249,7 +258,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 			tracker_sparql_builder_object (metadata, "nmm:Video");
 
 			if (tmp_metadata_video) {
-				ForeachCopyInfo info = { preupdate, metadata };
+				ForeachCopyInfo info = { preupdate, metadata, graph };
 				g_hash_table_foreach (tmp_metadata_video,
 				                      copy_hash_table_entry,
 				                      &info);
@@ -268,7 +277,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 			tracker_sparql_builder_object (metadata, "nfo:Audio");
 
 			if (tmp_metadata_audio) {
-				ForeachCopyInfo info = { preupdate, metadata };
+				ForeachCopyInfo info = { preupdate, metadata, graph };
 				g_hash_table_foreach (tmp_metadata_audio,
 				                      copy_hash_table_entry,
 				                      &info);



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