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



commit 61399a62816c2a067db61c3331d50d208386ed4e
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 77e06835..9d857a42 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,
@@ -300,6 +301,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
@@ -314,6 +316,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)
@@ -382,6 +389,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
@@ -396,6 +404,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)
@@ -636,6 +649,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
@@ -650,6 +664,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]