[gnome-music/wip/carlosg/tracker3: 27/68] grltrackerwrapper: Retrieve musicbrainz release id for songs



commit 399fe81709a4338f677c6808c98983f93508d9aa
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 24 02:43:05 2020 +0100

    grltrackerwrapper: Retrieve musicbrainz release id for songs

 gnomemusic/grilowrappers/grltrackerwrapper.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 4882f6ba..03e3ccc3 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -51,6 +51,7 @@ class GrlTrackerWrapper(GObject.GObject):
         Grl.METADATA_KEY_ID,
         Grl.METADATA_KEY_MB_ARTIST_ID,
         Grl.METADATA_KEY_MB_RECORDING_ID,
+        Grl.METADATA_KEY_MB_RELEASE_ID,
         Grl.METADATA_KEY_MB_TRACK_ID,
         Grl.METADATA_KEY_PLAY_COUNT,
         Grl.METADATA_KEY_THUMBNAIL,
@@ -323,6 +324,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nmm:artistName(nmm:performer(?song)) AS ?artist
             tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
+            tracker:referenceIdentifier(?release_id) AS ?mb_release_id
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
             nie:usageCounter(?song) AS ?play_count
@@ -347,6 +349,12 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?song nmm:musicAlbum ?album .
                 ?album nmm:albumArtist/nmm:artistName ?album_artist .
             }
+            OPTIONAL {
+                ?song nmm:musicAlbum ?album .
+                ?album tracker:hasExternalReference ?release_id .
+                ?release_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Release"; .
+            }
             OPTIONAL {
                 ?song nmm:performer ?artist .
                 ?artist tracker:hasExternalReference ?artist_id .
@@ -442,6 +450,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nmm:artistName(nmm:performer(?song)) AS ?artist
             tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
+            tracker:referenceIdentifier(?release_id) AS ?mb_release_id
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
             nie:usageCounter(?song) AS ?play_count
@@ -466,6 +475,12 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?song nmm:musicAlbum ?album .
                 ?album nmm:albumArtist/nmm:artistName ?album_artist .
             }
+            OPTIONAL {
+                ?song nmm:musicAlbum ?album .
+                ?album tracker:hasExternalReference ?release_id .
+                ?release_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Release"; .
+            }
             OPTIONAL {
                 ?song nmm:performer ?artist .
                 ?artist tracker:hasExternalReference ?artist_id .
@@ -720,6 +735,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nmm:artistName(nmm:performer(?song)) AS ?artist
             tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
+            tracker:referenceIdentifier(?release_id) AS ?mb_release_id
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
             nmm:trackNumber(?song) AS ?track_number
@@ -742,6 +758,11 @@ class GrlTrackerWrapper(GObject.GObject):
                     "https://musicbrainz.org/doc/Track"; .
             }
             OPTIONAL { ?album nmm:albumArtist/nmm:artistName ?album_artist . }
+            OPTIONAL {
+                ?album tracker:hasExternalReference ?release_id .
+                ?release_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Release"; .
+            }
             OPTIONAL {
                 ?song nmm:performer ?artist .
                 ?artist tracker:hasExternalReference ?artist_id .


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