[tracker/wip/extract-graphs] tracker-extract, vorbis: Do all inserts in miner-fs's graph
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/extract-graphs] tracker-extract, vorbis: Do all inserts in miner-fs's graph
- Date: Tue, 6 Sep 2011 09:05:00 +0000 (UTC)
commit 6c6f3dfb0eb66346ef871c1435b3cc34614bef1a
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Sep 6 10:57:07 2011 +0200
tracker-extract, vorbis: Do all inserts in miner-fs's graph
src/tracker-extract/tracker-extract-vorbis.c | 44 ++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 1c3473a..2de4bcb 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -99,6 +99,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
unsigned int bitrate;
gint time;
GFile *file;
+ const gchar *graph;
file = tracker_extract_info_get_file (info);
filename = g_file_get_path (file);
@@ -107,6 +108,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
preupdate = tracker_extract_info_get_preupdate_builder (info);
metadata = tracker_extract_info_get_metadata_builder (info);
+ graph = tracker_extract_info_get_graph (info);
if (!f) {
return FALSE;
@@ -167,11 +169,19 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
gchar *uri = tracker_sparql_escape_uri_printf ("urn:artist:%s", md.creator);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
+
tracker_sparql_builder_subject_iri (preupdate, uri);
tracker_sparql_builder_predicate (preupdate, "a");
tracker_sparql_builder_object (preupdate, "nmm:Artist");
tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
tracker_sparql_builder_object_unvalidated (preupdate, md.creator);
+
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
tracker_sparql_builder_predicate (metadata, "nmm:performer");
@@ -184,6 +194,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
gchar *album_disc_uri;
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
+
tracker_sparql_builder_subject_iri (preupdate, uri);
tracker_sparql_builder_predicate (preupdate, "a");
tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
@@ -192,6 +206,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
*/
tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
tracker_sparql_builder_object_unvalidated (preupdate, vd.album);
+
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
if (vd.track_count) {
@@ -208,11 +226,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumTrackCount");
tracker_sparql_builder_object_unvalidated (preupdate, vd.track_count);
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
@@ -230,11 +254,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumGain");
tracker_sparql_builder_object_double (preupdate, atof (vd.album_gain));
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
@@ -252,11 +282,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumPeakGain");
tracker_sparql_builder_object_double (preupdate, atof (vd.album_peak_gain));
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
@@ -287,6 +323,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
+
tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
tracker_sparql_builder_predicate (preupdate, "a");
tracker_sparql_builder_object (preupdate, "nmm:MusicAlbumDisc");
@@ -294,6 +334,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_object_int64 (preupdate, vd.disc_number ? atoi (vd.disc_number) : 1);
tracker_sparql_builder_predicate (preupdate, "nmm:albumDiscAlbum");
tracker_sparql_builder_object_iri (preupdate, uri);
+
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
tracker_sparql_builder_predicate (metadata, "nmm:musicAlbumDisc");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]