Improve the handling of cover art caches

Only download the cover art once at size=1000, then use that everywhere by scaling it down
This commit is contained in:
Sumner Evans
2020-02-22 07:56:40 -07:00
parent cf1e6f0dff
commit 1de7ba6327
10 changed files with 28 additions and 30 deletions

View File

@@ -856,16 +856,19 @@ class SublimeMusicApp(Gtk.Application):
if order_token != self.song_playing_order_token:
return
# Add the image to the notification, and re-draw the
# Add the image to the notification, and re-show the
# notification.
song_notification.set_image_from_pixbuf(
GdkPixbuf.Pixbuf.new_from_file(cover_art_filename))
GdkPixbuf.Pixbuf.new_from_file_at_scale(
cover_art_filename, 70, 70, True))
song_notification.show()
def get_cover_art_filename(order_token):
cover_art_future = CacheManager.get_cover_art_filename(
song.coverArt, size=70)
return cover_art_future.result(), order_token
return (
CacheManager.get_cover_art_filename(
song.coverArt).result(),
order_token,
)
self.song_playing_order_token += 1
cover_art_future = CacheManager.create_future(