[gnome-music/wip/jfelder/tracker3-rebased: 28/46] 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: 28/46] grltrackerwrapper: Retrieve musicbrainz release group id for songs
- Date: Sun, 2 Aug 2020 07:44:50 +0000 (UTC)
commit 418c1425683d0b46be8bbd94d27f36eb0b6e9235
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 7d515fa9..d8c10702 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:artist ?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:artist ?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:artist ?artist .
?artist tracker:hasExternalReference ?artist_id .
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]