[gnome-music/wip/mschraal/tageditor-13feb2020: 40/53] grltrackerwrapper: Retrieve musicbrainz release id for songs



commit 314ec71f45123452e710e16b81c41ad13bfe6cf0
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 972ac4a7..061dfc58 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,
@@ -328,6 +329,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
@@ -352,6 +354,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 .
@@ -434,6 +442,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
@@ -458,6 +467,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 .
@@ -712,6 +727,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
@@ -734,6 +750,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]