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



commit 4dc856912ce9c84bd065e0f38651123a2c5c7bac
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 24 02:11:14 2020 +0100

    grltrackerwrapper: Retrieve musicbrainz track 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 d427c83d..1e87e3fe 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -50,6 +50,7 @@ class GrlTrackerWrapper(GObject.GObject):
         Grl.METADATA_KEY_FAVOURITE,
         Grl.METADATA_KEY_ID,
         Grl.METADATA_KEY_MB_RECORDING_ID,
+        Grl.METADATA_KEY_MB_TRACK_ID,
         Grl.METADATA_KEY_PLAY_COUNT,
         Grl.METADATA_KEY_THUMBNAIL,
         Grl.METADATA_KEY_TITLE,
@@ -319,6 +320,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nie:title(?song) AS ?title
             tracker:id(?song) AS ?id
             tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
+            tracker:referenceIdentifier(?track_id) AS ?mb_track_id
             ?song
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
@@ -338,6 +340,11 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?recording_id tracker:referenceSource
                     "https://musicbrainz.org/doc/Recording"; .
             }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?track_id .
+                ?track_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Track"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -407,6 +414,7 @@ class GrlTrackerWrapper(GObject.GObject):
             nie:title(?song) AS ?title
             tracker:id(?song) AS ?id
             tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
+            tracker:referenceIdentifier(?track_id) AS ?mb_track_id
             ?song
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
@@ -426,6 +434,11 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?recording_id tracker:referenceSource
                     "https://musicbrainz.org/doc/Recording"; .
             }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?track_id .
+                ?track_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Track"; .
+            }
             OPTIONAL {
                 ?song nao:hasTag ?tag .
                 FILTER (?tag = nao:predefined-tag-favorite)
@@ -668,6 +681,7 @@ class GrlTrackerWrapper(GObject.GObject):
             ?song AS ?tracker_urn
             tracker:id(?song) AS ?id
             tracker:referenceIdentifier(?recording_id) AS ?mb_recording_id
+            tracker:referenceIdentifier(?track_id) AS ?mb_track_id
             nie:url(?song) AS ?url
             nie:title(?song) AS ?title
             nmm:artistName(nmm:performer(?song)) AS ?artist
@@ -687,6 +701,11 @@ class GrlTrackerWrapper(GObject.GObject):
                 ?recording_id tracker:referenceSource
                     "https://musicbrainz.org/doc/Recording"; .
             }
+            OPTIONAL {
+                ?song tracker:hasExternalReference ?track_id .
+                ?track_id tracker:referenceSource
+                    "https://musicbrainz.org/doc/Track"; .
+            }
             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]