[tracker/anonymous-file-nodes] Fixed bug with nmm:albumTrackCount being set to different values
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/anonymous-file-nodes] Fixed bug with nmm:albumTrackCount being set to different values
- Date: Tue, 26 Jan 2010 15:55:03 +0000 (UTC)
commit 114c18b11f2a88085ce5ffa82d90071827c64959
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Jan 26 16:53:18 2010 +0100
Fixed bug with nmm:albumTrackCount being set to different values
... for the same album, which was failing the insert query for
the entire song
src/tracker-extract/tracker-extract-gstreamer.c | 22 ++++++++++++++++++++++
src/tracker-extract/tracker-extract-mp3.c | 20 ++++++++++++++++++++
src/tracker-extract/tracker-extract-vorbis.c | 20 ++++++++++++++++++++
3 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 599aae6..d34e076 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -540,6 +540,9 @@ extract_metadata (MetadataExtractor *extractor,
s = NULL;
gst_tag_list_get_string (extractor->tagcache, GST_TAG_ALBUM, &s);
if (s) {
+ TrackerSparqlBuilder *delete_old;
+ const gchar *delete_old_qry;
+
album_uri = tracker_uri_printf_escaped ("urn:album:%s", s);
tracker_sparql_builder_insert_open (preupdate, NULL);
@@ -549,6 +552,25 @@ extract_metadata (MetadataExtractor *extractor,
tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
tracker_sparql_builder_object_unvalidated (preupdate, s);
+
+
+ delete_old = tracker_sparql_builder_new_update ();
+ tracker_sparql_builder_delete_open (delete_old, NULL);
+ tracker_sparql_builder_subject_iri (delete_old, album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_delete_close (delete_old);
+ tracker_sparql_builder_where_open (delete_old);
+ tracker_sparql_builder_subject_iri (delete_old, album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_where_close (delete_old);
+ delete_old_qry = tracker_sparql_builder_get_result (delete_old);
+
+ tracker_sparql_builder_prepend (preupdate, delete_old_qry);
+
+ g_object_unref (delete_old);
+
add_uint_gst_tag (preupdate, album_uri, "nmm:albumTrackCount", extractor->tagcache, GST_TAG_TRACK_COUNT);
add_uint_gst_tag (preupdate, album_uri, "nmm:setNumber", extractor->tagcache, GST_TAG_ALBUM_VOLUME_NUMBER);
*album = s;
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 9935408..43a704e 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -2001,6 +2001,26 @@ extract_mp3 (const gchar *uri,
tracker_sparql_builder_object_unvalidated (preupdate, md.album);
if (md.track_count > 0) {
+ TrackerSparqlBuilder *delete_old;
+ const gchar *delete_old_qry;
+
+ delete_old = tracker_sparql_builder_new_update ();
+ tracker_sparql_builder_delete_open (delete_old, NULL);
+ tracker_sparql_builder_subject_iri (delete_old, md.album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_delete_close (delete_old);
+ tracker_sparql_builder_where_open (delete_old);
+ tracker_sparql_builder_subject_iri (delete_old, md.album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_where_close (delete_old);
+ delete_old_qry = tracker_sparql_builder_get_result (delete_old);
+
+ tracker_sparql_builder_prepend (preupdate, delete_old_qry);
+
+ g_object_unref (delete_old);
+
tracker_sparql_builder_predicate (preupdate, "nmm:albumTrackCount");
tracker_sparql_builder_object_int64 (preupdate, md.track_count);
}
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 0eb44da..4a7ab1b 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -178,6 +178,26 @@ extract_vorbis (const char *uri,
tracker_sparql_builder_insert_close (preupdate);
if (vorbis_data.trackcount) {
+ TrackerSparqlBuilder *delete_old;
+ const gchar *delete_old_qry;
+
+ delete_old = tracker_sparql_builder_new_update ();
+ tracker_sparql_builder_delete_open (delete_old, NULL);
+ tracker_sparql_builder_subject_iri (delete_old, album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_delete_close (delete_old);
+ tracker_sparql_builder_where_open (delete_old);
+ tracker_sparql_builder_subject_iri (delete_old, album_uri);
+ tracker_sparql_builder_predicate (delete_old, "nmm:albumTrackCount");
+ tracker_sparql_builder_object_variable (delete_old, "unknown");
+ tracker_sparql_builder_where_close (delete_old);
+ delete_old_qry = tracker_sparql_builder_get_result (delete_old);
+
+ tracker_sparql_builder_prepend (preupdate, delete_old_qry);
+
+ g_object_unref (delete_old);
+
tracker_sparql_builder_predicate (metadata, "nmm:albumTrackCount");
tracker_sparql_builder_object_unvalidated (metadata, vorbis_data.trackcount);
g_free (vorbis_data.trackcount);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]