[tracker] tracker-extract: generated album / album-disc urns not very unique
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract: generated album / album-disc urns not very unique
- Date: Thu, 3 Oct 2013 13:45:03 +0000 (UTC)
commit 243b1eec70c52b4f8e720071235a72111ef44706
Author: Christophe Rhodes <csr21 cantab net>
Date: Thu Oct 3 14:43:36 2013 +0100
tracker-extract: generated album / album-disc urns not very unique
https://bugzilla.gnome.org/show_bug.cgi?id=707964
src/tracker-extract/tracker-extract-flac.c | 20 ++++++++++++++------
src/tracker-extract/tracker-extract-gstreamer.c | 23 ++++++++++++++++-------
src/tracker-extract/tracker-extract-vorbis.c | 19 +++++++++++++++----
3 files changed, 45 insertions(+), 17 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index cc1abc1..d013816 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -237,8 +237,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
}
if (fd.album) {
- album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s", fd.album);
-
+ if (fd.albumartist) {
+ album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s:%s", fd.album,
fd.albumartist);
+ } else {
+ album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s", fd.album);
+ }
tracker_sparql_builder_insert_open (preupdate, NULL);
if (graph) {
tracker_sparql_builder_graph_open (preupdate, graph);
@@ -355,10 +358,15 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
if (fd.album && album_uri) {
gchar *album_disc_uri;
-
- album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
- fd.album,
- fd.discno ? atoi(fd.discno) : 1);
+ if (fd.albumartist) {
+ album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:%s:Disc%d",
+ fd.album, fd.albumartist,
+ fd.discno ? atoi(fd.discno) : 1);
+ } else {
+ album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
+ fd.album,
+ fd.discno ? atoi(fd.discno) : 1);
+ }
tracker_sparql_builder_delete_open (preupdate, NULL);
tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 1312cdf..1ded93e 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -766,10 +766,12 @@ extractor_apply_album_metadata (MetadataExtractor *extractor,
album_artist = g_strdup (tracker_coalesce_strip (2, album_artist_temp, track_artist_temp));
- if (album_artist != NULL)
- add_artist (extractor, preupdate, graph, album_artist, p_album_artist_uri);
-
- *p_album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s", album_title);
+ if (album_artist != NULL) {
+ add_artist (extractor, preupdate, graph, album_artist, p_album_artist_uri);
+ *p_album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s:%s", album_title,
album_artist);
+ } else {
+ *p_album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s", album_title);
+ }
tracker_sparql_builder_insert_open (preupdate, NULL);
if (graph) {
@@ -826,9 +828,16 @@ extractor_apply_album_metadata (MetadataExtractor *extractor,
has_it = gst_tag_list_get_uint (tag_list, GST_TAG_ALBUM_VOLUME_NUMBER, &count);
- *p_album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
- album_title,
- has_it ? count : 1);
+ if (album_artist) {
+ *p_album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:%s:Disc%d",
+ album_title, album_artist,
+ has_it ? count : 1);
+ } else {
+ *p_album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
+ album_title,
+ has_it ? count : 1);
+ }
+
tracker_sparql_builder_delete_open (preupdate, NULL);
tracker_sparql_builder_subject_iri (preupdate, *p_album_disc_uri);
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index e228512..124be4f 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -191,7 +191,12 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
}
if (vd.album) {
- gchar *uri = tracker_sparql_escape_uri_printf ("urn:album:%s", vd.album);
+ gchar *uri;
+ if (vd.album_artist) {
+ uri = tracker_sparql_escape_uri_printf ("urn:album:%s:%s", vd.album,
vd.album_artist);
+ } else {
+ uri = tracker_sparql_escape_uri_printf ("urn:album:%s", vd.album);
+ }
gchar *album_disc_uri;
tracker_sparql_builder_insert_open (preupdate, NULL);
@@ -302,9 +307,15 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_insert_close (preupdate);
}
- album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
- vd.album,
- vd.disc_number ? atoi(vd.disc_number) : 1);
+ if (vd.album_artist) {
+ album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:%s:Disc%d",
+ vd.album, vd.album_artist,
+ vd.disc_number ?
atoi(vd.disc_number) : 1);
+ } else {
+ album_disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d",
+ vd.album,
+ vd.disc_number ?
atoi(vd.disc_number) : 1);
+ }
tracker_sparql_builder_delete_open (preupdate, NULL);
tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]