[gnome-music/wip/mschraal/core-thumb-property: 4/6] mpris: Use CoreSong thumbnail property



commit 1eef2fd16d68fbc2f8e8d5847824ddae464e94dc
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jun 14 20:51:35 2020 +0200

    mpris: Use CoreSong thumbnail property

 gnomemusic/mpris.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index d27c226d..89b500f9 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -27,7 +27,6 @@ import re
 
 from gi.repository import Gio, GLib
 
-from gnomemusic.albumartcache import lookup_art_file_from_cache
 from gnomemusic.gstplayer import Playback
 from gnomemusic.player import PlayerPlaylist, RepeatMode
 from gnomemusic.widgets.songwidget import SongWidget
@@ -372,21 +371,8 @@ class MPRIS(DBusInterface):
         if track_nr > 0:
             metadata['xesam:trackNumber'] = GLib.Variant('i', track_nr)
 
-        # If the media has already been part of an MPRIS playlist, its
-        # thumbnail is already set. Otherwise, try to look for it in the
-        # cache directory and set the media thumbnail for a future use.
-        # The search is only through the cache to prevent any delayed
-        # loading.
-        # FIXME: The thumbnail retrieval should take place in the
-        # player.
-        art_url = coresong.props.media.get_thumbnail()
-        if not art_url:
-            thumb_file = lookup_art_file_from_cache(coresong)
-            if thumb_file:
-                art_url = GLib.filename_to_uri(thumb_file.get_path())
-                coresong.props.media.set_thumbnail(art_url)
-
-        if art_url:
+        art_url = coresong.props.thumbnail
+        if art_url not in ["generic", "loading", ""]:
             metadata['mpris:artUrl'] = GLib.Variant('s', art_url)
 
         return metadata


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]