[gnome-music/wip/jfelder/tracker3-rebased: 31/49] grltrackerwrapper: Retrieve musicbrainz release group id for songs
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/tracker3-rebased: 31/49] grltrackerwrapper: Retrieve musicbrainz release group id for songs
- Date: Wed, 29 Jul 2020 14:15:25 +0000 (UTC)
commit 1ce5347314a6b22f6d2ed173376448e823a337d7
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jul 29 14:13:04 2020 +0200
grltrackerwrapper: Retrieve musicbrainz release group id for songs
gnomemusic/grilowrappers/grltrackerwrapper.py | 33 ++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 7dc94ba0..a2e9a4c7 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -52,6 +52,7 @@ class GrlTrackerWrapper(GObject.GObject):
Grl.METADATA_KEY_ID,
Grl.METADATA_KEY_MB_ARTIST_ID,
Grl.METADATA_KEY_MB_RECORDING_ID,
+ Grl.METADATA_KEY_MB_RELEASE_GROUP_ID,
Grl.METADATA_KEY_MB_RELEASE_ID,
Grl.METADATA_KEY_MB_TRACK_ID,
Grl.METADATA_KEY_PLAY_COUNT,
@@ -339,7 +340,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?urn ?title ?id ?mbRecording ?mbTrack ?url
- ?artist ?mbArtist ?album ?mbRelease
+ ?artist ?mbArtist ?album ?mbRelease ?mbReleaseGroup
?albumArtist ?duration ?trackNumber
?albumDiscNumber ?creationDate
nie:usageCounter(?urn) AS ?playCount
@@ -360,6 +361,8 @@ class GrlTrackerWrapper(GObject.GObject):
tracker:referenceIdentifier(?artist_id) AS ?mbArtist
nie:title(nmm:musicAlbum(?song)) AS ?album
tracker:referenceIdentifier(?release_id) AS ?mbRelease
+ tracker:referenceIdentifier(?release_group_id)
+ AS ?mbReleaseGroup
?album_artist AS ?albumArtist
nfo:duration(?song) AS ?duration
nmm:trackNumber(?song) AS ?trackNumber
@@ -390,6 +393,13 @@ class GrlTrackerWrapper(GObject.GObject):
?release_id tracker:referenceSource
"https://musicbrainz.org/doc/Release" .
}
+ OPTIONAL {
+ ?song nmm:musicAlbum ?album .
+ ?album tracker:hasExternalReference
+ ?release_group_id .
+ ?release_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release_Group" .
+ }
OPTIONAL {
?song nmm:performer ?artist .
?artist tracker:hasExternalReference ?artist_id .
@@ -479,7 +489,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?urn ?title ?id ?mbRecording ?mbTrack ?url
- ?artist ?mbArtist ?album ?mbRelease
+ ?artist ?mbArtist ?album ?mbRelease ?mbReleaseGroup
?albumArtist ?duration ?trackNumber
?albumDiscNumber ?creationDate
nie:usageCounter(?urn) AS ?playCount
@@ -500,6 +510,8 @@ class GrlTrackerWrapper(GObject.GObject):
tracker:referenceIdentifier(?artist_id) AS ?mbArtist
nie:title(nmm:musicAlbum(?song)) AS ?album
tracker:referenceIdentifier(?release_id) AS ?mbRelease
+ tracker:referenceIdentifier(?release_group_id)
+ AS ?mbReleaseGroup
?album_artist AS ?albumArtist
nfo:duration(?song) AS ?duration
nmm:trackNumber(?song) AS ?trackNumber
@@ -530,6 +542,13 @@ class GrlTrackerWrapper(GObject.GObject):
?release_id tracker:referenceSource
"https://musicbrainz.org/doc/Release" .
}
+ OPTIONAL {
+ ?song nmm:musicAlbum ?album .
+ ?album tracker:hasExternalReference
+ ?release_group_id .
+ ?release_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release_Group" .
+ }
OPTIONAL {
?song nmm:performer ?artist .
?artist tracker:hasExternalReference ?artist_id .
@@ -824,7 +843,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?id ?mbRecording ?mbTrack ?url ?title
- ?artist ?mbArtist ?album ?mbRelease
+ ?artist ?mbArtist ?album ?mbRelease ?mbReleaseGroup
?albumArtist ?duration ?trackNumber ?albumDiscNumber
?creationDate
nie:usageCounter(?id) AS ?playCount
@@ -844,6 +863,8 @@ class GrlTrackerWrapper(GObject.GObject):
tracker:referenceIdentifier(?artist_id) AS ?mbArtist
nie:title(nmm:musicAlbum(?song)) AS ?album
tracker:referenceIdentifier(?release_id) AS ?mbRelease
+ tracker:referenceIdentifier(?release_group_id)
+ AS ?mbReleaseGroup
?album_artist AS ?albumArtist
nfo:duration(?song) AS ?duration
nmm:trackNumber(?song) AS ?trackNumber
@@ -871,6 +892,12 @@ class GrlTrackerWrapper(GObject.GObject):
?release_id tracker:referenceSource
"https://musicbrainz.org/doc/Release" .
}
+ OPTIONAL {
+ ?album tracker:hasExternalReference
+ ?release_group_id .
+ ?release_group_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release_Group" .
+ }
OPTIONAL {
?song nmm:performer ?artist .
?artist tracker:hasExternalReference ?artist_id .
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]