[gnome-music/wip/jfelder/songeditor-gtk4: 12/32] grltrackerwrapper: Retrieve musicbrainz artist id for songs
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/songeditor-gtk4: 12/32] grltrackerwrapper: Retrieve musicbrainz artist id for songs
- Date: Fri, 11 Feb 2022 22:47:47 +0000 (UTC)
commit 52393430e51a04efc3975834f643ff277e2e3f3f
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jul 29 13:32:30 2020 +0200
grltrackerwrapper: Retrieve musicbrainz artist id for songs
gnomemusic/grilowrappers/grltrackerwrapper.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 8e964e1cd..3ce5f8b56 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -69,6 +69,7 @@ class GrlTrackerWrapper(GObject.GObject):
Grl.METADATA_KEY_DURATION,
Grl.METADATA_KEY_FAVOURITE,
Grl.METADATA_KEY_ID,
+ Grl.METADATA_KEY_MB_ARTIST_ID,
Grl.METADATA_KEY_MB_RECORDING_ID,
Grl.METADATA_KEY_MB_TRACK_ID,
Grl.METADATA_KEY_PLAY_COUNT,
@@ -427,7 +428,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = " ".join(f"""
SELECT
?type ?urn ?title ?id ?mbRecording ?mbTrack ?url
- ?artist ?album
+ ?artist ?mbArtist ?album
?albumArtist ?duration ?trackNumber
?albumDiscNumber ?publicationDate
nie:usageCounter(?urn) AS ?playCount
@@ -445,6 +446,7 @@ class GrlTrackerWrapper(GObject.GObject):
tracker:referenceIdentifier(?track_id) AS ?mbTrack
nie:isStoredAs(?song) AS ?url
nmm:artistName(nmm:artist(?song)) AS ?artist
+ tracker:referenceIdentifier(?artist_id) AS ?mbArtist
nie:title(nmm:musicAlbum(?song)) AS ?album
?album_artist AS ?albumArtist
nfo:duration(?song) AS ?duration
@@ -464,6 +466,12 @@ class GrlTrackerWrapper(GObject.GObject):
?track_id tracker:referenceSource
"https://musicbrainz.org/doc/Track" .
}}
+ OPTIONAL {{
+ ?song nmm:artist ?artist .
+ ?artist tracker:hasExternalReference ?artist_id .
+ ?artist_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Artist" .
+ }}
OPTIONAL {{ ?song nie:contentCreated ?date . }}
{songs_filter}
{location_filter}
@@ -829,7 +837,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?id ?mbRecording ?mbTrack ?url ?title
- ?artist ?album
+ ?artist ?mbArtist ?album
?albumArtist ?duration ?trackNumber ?albumDiscNumber
?publicationDate
nie:usageCounter(?id) AS ?playCount
@@ -846,6 +854,7 @@ class GrlTrackerWrapper(GObject.GObject):
nie:isStoredAs(?song) AS ?url
nie:title(?song) AS ?title
nmm:artistName(nmm:artist(?song)) AS ?artist
+ tracker:referenceIdentifier(?artist_id) AS ?mbArtist
nie:title(nmm:musicAlbum(?song)) AS ?album
?album_artist AS ?albumArtist
nfo:duration(?song) AS ?duration
@@ -869,6 +878,12 @@ class GrlTrackerWrapper(GObject.GObject):
OPTIONAL { ?song nie:contentCreated ?date . }
OPTIONAL { ?album nmm:albumArtist/
nmm:artistName ?album_artist . }
+ OPTIONAL {
+ ?song nmm:artist ?artist .
+ ?artist tracker:hasExternalReference ?artist_id .
+ ?artist_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Artist" .
+ }
FILTER (
?album = <%(album_id)s> &&
nmm:setNumber(nmm:musicAlbumDisc(?song)) =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]