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



commit 01a4f4f92674f3bae2307950364a781988a6745d
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 9d857a42..15b7e3e8 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,
@@ -302,6 +303,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
@@ -321,6 +323,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)
@@ -390,6 +397,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
@@ -409,6 +417,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)
@@ -650,6 +663,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
@@ -669,6 +683,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]