[gnome-music/wip/carlosg/tracker3: 23/68] grltrackerwrapper: Retrieve musicbrainz recording id for songs



commit 68e544f6f3b82bba0dcaf4cb88708ed0a487e921
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 b6f68941..310813cd 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,
@@ -312,6 +313,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
@@ -326,6 +328,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)
@@ -407,6 +414,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
@@ -421,6 +429,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)
@@ -662,6 +675,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
@@ -676,6 +690,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]