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



commit e3e1f68ddefa127dd5ff530b13c2b233d3ba40a1
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 24 02:38:39 2020 +0100

    grltrackerwrapper: Retrieve musicbrainz artist id for songs

 gnomemusic/grilowrappers/grltrackerwrapper.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 734a3ef2..972ac4a7 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -49,6 +49,7 @@ class GrlTrackerWrapper(GObject.GObject):
         Grl.METADATA_KEY_DURATION,
         Grl.METADATA_KEY_FAVOURITE,
         Grl.METADATA_KEY_ID,
+        Grl.METADATA_KEY_MB_ARTIST_ID,
         Grl.METADATA_KEY_MB_RECORDING_ID,
         Grl.METADATA_KEY_MB_TRACK_ID,
         Grl.METADATA_KEY_PLAY_COUNT,
@@ -325,6 +326,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
             nmm:artistName(nmm:performer(?song)) AS ?artist
+            tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
@@ -350,6 +352,12 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?song nmm:musicAlbum ?album .
                 ?album nmm:albumArtist/nmm:artistName ?album_artist .
             }
+            OPTIONAL {
+                ?song nmm:performer ?artist .
+                ?artist tracker:hasExternalReference ?artist_id .
+                ?artist_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Artist"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -424,6 +432,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
             nmm:artistName(nmm:performer(?song)) AS ?artist
+            tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
@@ -449,6 +458,12 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?song nmm:musicAlbum ?album .
                 ?album nmm:albumArtist/nmm:artistName ?album_artist .
             }
+            OPTIONAL {
+                ?song nmm:performer ?artist .
+                ?artist tracker:hasExternalReference ?artist_id .
+                ?artist_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Artist"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -695,6 +710,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
             nmm:artistName(nmm:performer(?song)) AS ?artist
+            tracker:referenceIdentifier(?artist_id) AS ?mb_artist_id
             nie:title(nmm:musicAlbum(?song)) AS ?album
             ?album_artist AS ?album_artist
             nfo:duration(?song) AS ?duration
@@ -718,6 +734,12 @@ class GrlTrackerWrapper(GObject.GObject):
                     "https://musicbrainz.org/doc/Track"; .
             }
             OPTIONAL { ?album nmm:albumArtist/nmm:artistName ?album_artist . }
+            OPTIONAL {
+                ?song nmm:performer ?artist .
+                ?artist tracker:hasExternalReference ?artist_id .
+                ?artist_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Artist"; .
+            }
             OPTIONAL { ?song nao:hasTag ?tag .
                        FILTER (?tag = nao:predefined-tag-favorite) } .
             FILTER ( tracker:id(?album) = %(album_id)s


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