[gnome-music] grltrackerwrapper: Retrieve MusicBrainz album ids to get cover art
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] grltrackerwrapper: Retrieve MusicBrainz album ids to get cover art
- Date: Sat, 2 Nov 2019 14:17:33 +0000 (UTC)
commit d5c96d4ef3745d433aea9fe4fa9ecf63251b90d0
Author: Jean Felder <jfelder src gnome org>
Date: Mon Sep 2 12:29:08 2019 +0200
grltrackerwrapper: Retrieve MusicBrainz album ids to get cover art
There are two MusicBrainz identifiers associated with an album:
Release and Release_Group. These tags are supported by Tracker since
version 2.3.
By updating the queries of `_get_album_for_song_id` and
`_get_album_for_album_id` to retrieve those identifiers, it is now
possible to use grl-musicbrainz-coverart plugin to download an album's
cover art from https://coverartarchive.org/ website.
This change also depends on grilo-plugins version 0.3.10 which adds
support for tracker:ExternalReference in the Tracker plugin.
This work (Tracker and grilo-plugins support) was done by Sumaid Syed
as part as a Google Summer of Code project.
Closes: #205
gnomemusic/coregrilo.py | 3 ++-
gnomemusic/grilowrappers/grltrackerwrapper.py | 26 ++++++++++++++++++++++++++
meson.build | 2 +-
3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index e2001bf2..0d34dc34 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -43,7 +43,8 @@ class CoreGrilo(GObject.GObject):
'grl-spotify-cover'
]
- _grl_plugin_ranks = ("grl-lastfm-cover:2,"
+ _grl_plugin_ranks = ("grl-musicbrainz-coverart:3,"
+ "grl-lastfm-cover:2,"
"grl-theaudiodb-cover:1")
_theaudiodb_api_key = "195003"
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index ace4bb61..ceb8242e 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -834,6 +834,9 @@ class GrlTrackerWrapper(GObject.GObject):
SELECT DISTINCT
rdf:type(?album)
tracker:id(?album) AS ?id
+ tracker:referenceIdentifier(?release_group_id)
+ AS ?mb_release_group_id
+ tracker:referenceIdentifier(?release_id) AS ?mb_release_id
tracker:coalesce(nmm:artistName(?album_artist),
nmm:artistName(?song_artist)) AS ?artist
nie:title(?album) AS ?album
@@ -842,6 +845,16 @@ class GrlTrackerWrapper(GObject.GObject):
?song a nmm:MusicPiece ;
nmm:musicAlbum ?album ;
nmm:performer ?song_artist .
+ OPTIONAL {
+ ?album tracker:hasExternalReference ?release_group_id .
+ ?release_group_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release_Group" .
+ }
+ OPTIONAL {
+ ?album tracker:hasExternalReference ?release_id .
+ ?release_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release" .
+ }
OPTIONAL { ?album nmm:albumArtist ?album_artist . }
FILTER (
tracker:id(?album) = %(album_id)s
@@ -861,6 +874,9 @@ class GrlTrackerWrapper(GObject.GObject):
SELECT DISTINCT
rdf:type(?album)
tracker:id(?album) AS ?id
+ tracker:referenceIdentifier(?release_group_id)
+ AS ?mb_release_group_id
+ tracker:referenceIdentifier(?release_id) AS ?mb_release_id
tracker:coalesce(nmm:artistName(?album_artist),
nmm:artistName(?song_artist)) AS ?artist
nie:title(?album) AS ?album
@@ -868,6 +884,16 @@ class GrlTrackerWrapper(GObject.GObject):
?song a nmm:MusicPiece ;
nmm:musicAlbum ?album ;
nmm:performer ?song_artist .
+ OPTIONAL {
+ ?album tracker:hasExternalReference ?release_group_id .
+ ?release_group_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release_Group" .
+ }
+ OPTIONAL {
+ ?album tracker:hasExternalReference ?release_id .
+ ?release_id tracker:referenceSource
+ "https://musicbrainz.org/doc/Release" .
+ }
OPTIONAL { ?album nmm:albumArtist ?album_artist . }
FILTER (
tracker:id(?song) = %(song_id)s
diff --git a/meson.build b/meson.build
index 23aa7612..bb147bdc 100644
--- a/meson.build
+++ b/meson.build
@@ -46,7 +46,7 @@ dependency('tracker-sparql-2.0', version: '>= 2.3.0')
dependency('pygobject-3.0', version: '>= 3.29.1')
dependency('py3cairo', version: '>= 1.14.0')
dependency('grilo-0.3', version: '>= 0.3.9')
-dependency('grilo-plugins-0.3', version: '>= 0.3.9')
+dependency('grilo-plugins-0.3', version: '>= 0.3.10')
subproject('libgd',
default_options: [
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]