[gnome-music/wip/mschraal/artrework: 2/3] albumartcache: Fix MPRIS thumbnail retrieval
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/artrework: 2/3] albumartcache: Fix MPRIS thumbnail retrieval
- Date: Sun, 28 Jan 2018 20:03:57 +0000 (UTC)
commit 3d36090f1349da683f6c6e76ca58b3adc0155537
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Jan 28 16:34:00 2018 +0100
albumartcache: Fix MPRIS thumbnail retrieval
gnomemusic/albumartcache.py | 13 +++++++++++++
gnomemusic/player.py | 4 ++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/albumartcache.py b/gnomemusic/albumartcache.py
index 373ceb3..d312bb1 100644
--- a/gnomemusic/albumartcache.py
+++ b/gnomemusic/albumartcache.py
@@ -263,6 +263,7 @@ class Art(GObject.GObject):
surface = _make_icon_frame(pixbuf, self._size, self._scale)
self._surface = surface
+ self._set_grilo_thumbnail_path()
self.emit('finished')
@@ -333,6 +334,18 @@ class Art(GObject.GObject):
return False
+ def _set_grilo_thumbnail_path(self):
+ # TODO: This sets the thumbnail path for the Grilo Media object
+ # to be used by MPRIS. However, calling this by default for
+ # every cache hit is unnecessary.
+ album = utils.get_album_title(self._media)
+ artist = utils.get_artist_name(self._media)
+
+ success, thumb_file = MediaArt.get_file(artist, album, "album")
+ if success:
+ self._media.set_thumbnail(
+ GLib.filename_to_uri(thumb_file.get_path(), None))
+
@GObject.Property
@log
def surface(self):
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 8bd0478..ca5a119 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -580,6 +580,7 @@ class Player(GObject.GObject):
self.artistLabel.set_label(artist)
art = ArtImage(Art.Size.XSMALL, media)
+ art.connect('finished', self._on_art_finished)
art.image = self._image
title = utils.get_media_title(media)
@@ -633,8 +634,7 @@ class Player(GObject.GObject):
return False
@log
- def _on_cache_lookup(self, surface, data=None):
- # FIXME: Need this for mpris
+ def _on_art_finished(self, klass):
self.emit('thumbnail-updated')
@log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]