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



commit c1d1e9168b457aeffd7b35aebe0c1cadeb594877
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Nov 24 19:17:52 2019 +0100

    grltrackerwrapper: Retrieve musicbrainz recording id for songs

 gnomemusic/grilowrappers/grltrackerwrapper.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 8ac1662f..d427c83d 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_RECORDING_ID,
         Grl.METADATA_KEY_PLAY_COUNT,
         Grl.METADATA_KEY_THUMBNAIL,
         Grl.METADATA_KEY_TITLE,
@@ -317,6 +318,7 @@ class GrlTrackerWrapper(GObject.GObject):
             ?song AS ?tracker_urn
             nie:title(?song) AS ?title
             tracker:id(?song) AS ?id
+            tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
             ?song
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
@@ -331,6 +333,11 @@ class GrlTrackerWrapper(GObject.GObject):
         WHERE {
             ?song a nmm:MusicPiece .
             OPTIONAL { ?song nie:contentCreated ?date . }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?recording_id .
+                ?recording_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Recording"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -399,6 +406,7 @@ class GrlTrackerWrapper(GObject.GObject):
             ?song AS ?tracker_urn
             nie:title(?song) AS ?title
             tracker:id(?song) AS ?id
+            tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
             ?song
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
@@ -413,6 +421,11 @@ class GrlTrackerWrapper(GObject.GObject):
         WHERE {
             ?song a nmm:MusicPiece .
             OPTIONAL { ?song nie:contentCreated ?date . }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?recording_id .
+                ?recording_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Recording"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -654,6 +667,7 @@ class GrlTrackerWrapper(GObject.GObject):
             rdf:type(?song)
             ?song AS ?tracker_urn
             tracker:id(?song) AS ?id
+            tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
             nmm:artistName(nmm:performer(?song)) AS ?artist
@@ -668,6 +682,11 @@ class GrlTrackerWrapper(GObject.GObject):
             ?song a nmm:MusicPiece ;
                     nmm:musicAlbum ?album .
             OPTIONAL { ?song nie:contentCreated ?date . }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?recording_id .
+                ?recording_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Recording"; .
+            }
             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]