[tracker/multidisc-album: 8/11] tracker-extract: Make multi-disc albums work in FLAC extractor
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/multidisc-album: 8/11] tracker-extract: Make multi-disc albums work in FLAC extractor
- Date: Fri, 3 Dec 2010 15:13:18 +0000 (UTC)
commit 07b3c4b63f5304cef852500d6c3af0eb35075f59
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Dec 3 16:07:02 2010 +0100
tracker-extract: Make multi-disc albums work in FLAC extractor
src/tracker-extract/tracker-extract-flac.c | 55 ++++++++++++++++++++++++++--
1 files changed, 52 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index 7938be9..f13b3e5 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -326,8 +326,57 @@ extract_flac (const gchar *uri,
add_tuple (metadata, "nie:title", fd.title);
add_tuple (metadata, "nmm:trackNumber", fd.tracknumber);
- /* FIXME: This is commented out in vorbis extractor... */
- add_tuple (metadata, "nmm:setNumber", fd.discno);
+ if (fd.discno && fd.album && album_uri) {
+ gchar *album_disc_uri;
+
+ album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
+ fd.album, atoi(fd.discno));
+
+ tracker_sparql_builder_insert_open (preupdate, NULL);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "a");
+ tracker_sparql_builder_object (preupdate, "nmm:MusicAlbumDisc");
+ tracker_sparql_builder_insert_close (preupdate);
+
+ tracker_sparql_builder_delete_open (preupdate, NULL);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:setNumber");
+ tracker_sparql_builder_object_variable (preupdate, "unknown");
+ tracker_sparql_builder_delete_close (preupdate);
+ tracker_sparql_builder_where_open (preupdate);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:setNumber");
+ tracker_sparql_builder_object_variable (preupdate, "unknown");
+ tracker_sparql_builder_where_close (preupdate);
+
+ tracker_sparql_builder_insert_open (preupdate, NULL);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:setNumber");
+ tracker_sparql_builder_object_int64 (preupdate, atoi (fd.discno));
+ tracker_sparql_builder_insert_close (preupdate);
+
+ tracker_sparql_builder_delete_open (preupdate, NULL);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:albumDiscAlbum");
+ tracker_sparql_builder_object_variable (preupdate, "unknown");
+ tracker_sparql_builder_delete_close (preupdate);
+ tracker_sparql_builder_where_open (preupdate);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:albumDiscAlbum");
+ tracker_sparql_builder_object_variable (preupdate, "unknown");
+ tracker_sparql_builder_where_close (preupdate);
+
+ tracker_sparql_builder_insert_open (preupdate, NULL);
+ tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
+ tracker_sparql_builder_predicate (preupdate, "nmm:albumDiscAlbum");
+ tracker_sparql_builder_object_iri (preupdate, album_uri);
+ tracker_sparql_builder_insert_close (preupdate);
+
+ tracker_sparql_builder_predicate (metadata, "nmm:musicAlbumDisk");
+ tracker_sparql_builder_object_iri (metadata, album_disc_uri);
+
+ g_free (album_disc_uri);
+ }
/* FIXME: Trackgain/Trackpeakgain: commented out in vorbis */
@@ -368,7 +417,7 @@ extract_flac (const gchar *uri,
tracker_sparql_builder_predicate (metadata, "nfo:duration");
tracker_sparql_builder_object_int64 (metadata,
stream->data.stream_info.total_samples /
- stream->data.stream_info.sample_rate);
+ stream->data.stream_info.sample_rate);
}
g_free (fd.artist);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]