[gnome-music/wip/jfelder/tracker3-rebased: 26/49] grltrackerwrapper: Retrieve musicbrainz recording id for songs
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/tracker3-rebased: 26/49] grltrackerwrapper: Retrieve musicbrainz recording id for songs
- Date: Wed, 29 Jul 2020 14:15:25 +0000 (UTC)
commit 89b9fc2db6057a5c7c10e5b59d37a0b502a62961
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jul 29 12:31:34 2020 +0200
grltrackerwrapper: Retrieve musicbrainz recording id for songs
gnomemusic/grilowrappers/grltrackerwrapper.py | 28 ++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 7182b384..73251985 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -50,6 +50,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,
@@ -334,7 +335,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
- ?type ?urn ?title ?id ?url
+ ?type ?urn ?title ?id ?mbRecording ?url
?artist ?album
?duration ?trackNumber
?albumDiscNumber ?creationDate
@@ -348,6 +349,8 @@ class GrlTrackerWrapper(GObject.GObject):
?song AS ?urn
nie:title(?song) AS ?title
?song AS ?id
+ tracker:referenceIdentifier(?recording_id)
+ AS ?mbRecording
nie:isStoredAs(?song) AS ?url
nmm:artistName(nmm:performer(?song)) AS ?artist
nie:title(nmm:musicAlbum(?song)) AS ?album
@@ -358,6 +361,11 @@ class GrlTrackerWrapper(GObject.GObject):
YEAR(?date) AS ?creationDate
WHERE {
?song a nmm:MusicPiece .
+ OPTIONAL {
+ ?song tracker:hasExternalReference ?recording_id .
+ ?recording_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Recording" .
+ }
OPTIONAL { ?song nie:contentCreated ?date . }
FILTER ( ?song in ( %(media_ids)s ) )
%(location_filter)s
@@ -441,7 +449,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
- ?type ?urn ?title ?id ?url
+ ?type ?urn ?title ?id ?mbRecording ?url
?artist ?album
?duration ?trackNumber
?albumDiscNumber ?creationDate
@@ -455,6 +463,8 @@ class GrlTrackerWrapper(GObject.GObject):
?song AS ?urn
nie:title(?song) AS ?title
?song AS ?id
+ tracker:referenceIdentifier(?recording_id)
+ AS ?mbRecording
nie:isStoredAs(?song) AS ?url
nmm:artistName(nmm:performer(?song)) AS ?artist
nie:title(nmm:musicAlbum(?song)) AS ?album
@@ -465,6 +475,11 @@ class GrlTrackerWrapper(GObject.GObject):
YEAR(?date) AS ?creationDate
WHERE {
?song a nmm:MusicPiece .
+ OPTIONAL {
+ ?song tracker:hasExternalReference ?recording_id .
+ ?recording_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Recording" .
+ }
OPTIONAL { ?song nie:contentCreated ?date . }
%(location_filter)s
}
@@ -753,7 +768,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
- ?type ?id ?url ?title
+ ?type ?id ?mbRecording ?url ?title
?artist ?album
?duration ?trackNumber ?albumDiscNumber
?creationDate
@@ -765,6 +780,8 @@ class GrlTrackerWrapper(GObject.GObject):
SELECT DISTINCT
%(media_type)s AS ?type
?song AS ?id
+ tracker:referenceIdentifier(?recording_id)
+ AS ?mbRecording
nie:isStoredAs(?song) AS ?url
nie:title(?song) AS ?title
nmm:artistName(nmm:performer(?song)) AS ?artist
@@ -777,6 +794,11 @@ class GrlTrackerWrapper(GObject.GObject):
WHERE {
?song a nmm:MusicPiece ;
nmm:musicAlbum ?album .
+ OPTIONAL {
+ ?song tracker:hasExternalReference ?recording_id .
+ ?recording_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Recording" .
+ }
OPTIONAL { ?song nie:contentCreated ?date . }
FILTER (
?album = <%(album_id)s> &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]