[tracker/wip/sam/resource-rebase-1] squash! Use TrackerResource instead of TrackerSparqlBuilder in all extractors



commit 6d4b6832a9e9f4052e524643551851195aba58ab
Author: Sam Thursfield <sam afuera me uk>
Date:   Thu Jun 30 02:24:56 2016 +0100

    squash! Use TrackerResource instead of TrackerSparqlBuilder in all extractors
    
    Fix potential crashes in FLAC extractor

 src/tracker-extract/tracker-extract-flac.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index 16344b9..ec73f2e 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -208,11 +208,19 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                }
        } while (FLAC__metadata_simple_iterator_next (iter));
 
+       metadata = tracker_resource_new (NULL);
+       tracker_resource_add_uri (metadata, "rdf:type", "nmm:MusicPiece");
+       tracker_resource_add_uri (metadata, "rdf:type", "nfo:Audio");
+
        creator = tracker_coalesce_strip (3, fd.artist, fd.albumartist,
                                          fd.performer);
 
        if (creator) {
                artist = tracker_extract_new_artist (creator);
+
+               tracker_resource_set_relation (metadata, "nmm:performer", artist);
+
+               g_object_unref (artist);
        }
 
        if (fd.album) {
@@ -226,8 +234,6 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                                                                   album_artist,
                                                                   fd.discno ? atoi(fd.discno) : 1);
 
-               g_object_unref (album_artist);
-
                album = tracker_resource_get_first_relation (album_disc, "nmm:albumDiscAlbum");
                tracker_resource_set_string (album, "nmm:albumTrackCount", fd.trackcount);
 
@@ -238,19 +244,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                if (fd.albumpeakgain) {
                        tracker_resource_set_double (album, "nmm:albumPeakGain", atof (fd.albumpeakgain));
                }
-       }
-
-       metadata = tracker_resource_new (NULL);
-       tracker_resource_add_uri (metadata, "rdf:type", "nmm:MusicPiece");
-       tracker_resource_add_uri (metadata, "rdf:type", "nfo:Audio");
-
-       tracker_resource_set_relation (metadata, "nmm:performer", artist);
-       g_object_unref (artist);
 
-       tracker_resource_set_relation (metadata, "nmm:musicAlbum", album);
-       tracker_resource_set_relation (metadata, "nmm:musicAlbumDisc", album_disc);
+               tracker_resource_set_relation (metadata, "nmm:musicAlbum", album);
+               tracker_resource_set_relation (metadata, "nmm:musicAlbumDisc", album_disc);
 
-       g_object_unref (album_disc);
+               g_object_unref (album_disc);
+               g_object_unref (album_artist);
+       }
 
        tracker_guarantee_resource_title_from_file (metadata, "nie:title", fd.title, uri, NULL);
        add_tuple (metadata, "nmm:trackNumber", fd.tracknumber);


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