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



commit 1280fc903591c1dc5ec5327785c7e7c4bdde727f
Author: Sam Thursfield <sam afuera me uk>
Date:   Thu Jun 30 02:12:09 2016 +0100

    squash! Use TrackerResource instead of TrackerSparqlBuilder in all extractors
    
    Fix some warnings during extractions that I found.

 src/libtracker-extract/tracker-resource-helpers.c |    1 +
 src/tracker-extract/tracker-extract-gstreamer.c   |   13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-resource-helpers.c 
b/src/libtracker-extract/tracker-resource-helpers.c
index 9e16687..a37570e 100644
--- a/src/libtracker-extract/tracker-resource-helpers.c
+++ b/src/libtracker-extract/tracker-resource-helpers.c
@@ -264,6 +264,7 @@ tracker_extract_new_music_album_disc (const char *album_title,
 
        disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d", album_title, disc_number);
        album_disc = tracker_resource_new (disc_uri);
+       tracker_resource_set_uri (album_disc, "rdf:type", "nmm:MusicAlbumDisc");
        tracker_resource_set_int (album_disc, "nmm:setNumber", disc_number > 0 ? disc_number : 1);
        tracker_resource_add_relation (album_disc, "nmm:albumDiscAlbum", album);
 
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index b6881c9..eaeabd6 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -632,8 +632,8 @@ extractor_apply_general_metadata (MetadataExtractor     *extractor,
 }
 
 static TrackerResource *
-extractor_get_album_disc (MetadataExtractor *extractor,
-                          GstTagList        *tag_list)
+extractor_maybe_get_album_disc (MetadataExtractor *extractor,
+                                GstTagList        *tag_list)
 {
        TrackerResource *album = NULL, *album_artist = NULL, *album_disc = NULL;
        gchar *album_uri, *album_disc_uri;
@@ -941,7 +941,7 @@ extract_metadata (MetadataExtractor      *extractor,
                        tracker_resource_set_uri (resource, "rdf:type", "nfo:Audio");
 
                        if (extractor->toc == NULL || extractor->toc->entry_list == NULL)
-                               tracker_resource_add_uri (resource, "rdf:type", "nfo:MusicPiece");
+                               tracker_resource_add_uri (resource, "rdf:type", "nmm:MusicPiece");
 
 #ifdef HAVE_LIBMEDIAART
                        extractor->media_art_type = MEDIA_ART_ALBUM;
@@ -999,7 +999,7 @@ extract_metadata (MetadataExtractor      *extractor,
                }
 
                if (extractor->mime == EXTRACT_MIME_AUDIO) {
-                       album_disc = extractor_get_album_disc (extractor, extractor->tagcache);
+                       album_disc = extractor_maybe_get_album_disc (extractor, extractor->tagcache);
 
                        extractor_apply_audio_metadata (extractor,
                                                        extractor->tagcache,
@@ -1024,7 +1024,8 @@ extract_metadata (MetadataExtractor      *extractor,
                                tracker_resource_set_string (resource, "nie:url", file_url);
                        }
 
-                       g_object_unref (album_disc);
+                       if (album_disc)
+                               g_object_unref (album_disc);
                }
        }
 
@@ -1048,7 +1049,7 @@ extract_metadata (MetadataExtractor      *extractor,
                        tracker_resource_set_string (hash_resource, "nfo:hashValue", hash_str);
                        g_free (hash_str);
 
-                       tracker_resource_set_string (resource, "nfo:hashAlgorithm", "gibest");
+                       tracker_resource_set_string (hash_resource, "nfo:hashAlgorithm", "gibest");
 
                        tracker_resource_set_relation (resource, "nfo:hasHash", hash_resource);
 


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