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



commit b14b955c2c3f480f175518291175a37bc1cfea75
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 6c1538d3..2a545324 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)
@@ -432,6 +440,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
@@ -457,6 +466,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)
@@ -703,6 +718,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
@@ -726,6 +742,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]