[gnome-music/wip/mschraal/coresong-thumbnail-prop: 172/179] songart: More stuff



commit 65a89920d0025cadf404ae1596c96b235302f2a5
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Dec 24 10:11:36 2019 +0100

    songart: More stuff

 gnomemusic/coresong.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/gnomemusic/coresong.py b/gnomemusic/coresong.py
index 2b2632c1..2cfeeb03 100644
--- a/gnomemusic/coresong.py
+++ b/gnomemusic/coresong.py
@@ -29,6 +29,7 @@ gi.require_version('Grl', '0.3')
 from gi.repository import Grl, GLib, GObject
 
 import gnomemusic.utils as utils
+from gnomemusic.songart import SongArt
 
 
 class CoreSong(GObject.GObject):
@@ -62,6 +63,7 @@ class CoreSong(GObject.GObject):
         self._coreselection = application.props.coreselection
         self._favorite = False
         self._selected = False
+        self._thumbnail = None
 
         self.props.grlid = media.get_source() + media.get_id()
         self._is_tracker = media.get_source() == "grl-tracker-source"
@@ -111,6 +113,22 @@ class CoreSong(GObject.GObject):
         self._selected = value
         self._coreselection.update_selection(self, self._selected)
 
+    @GObject.Property(type=str, default=None)
+    def thumbnail(self):
+        if self._thumbnail == None:
+            self._thumbnail = "loading"
+
+            SongArt(self, self._coremodel)
+
+        return self._thumbnail
+
+    @thumbnail.setter
+    def thumbnail(self, value):
+        if self._thumbnail == value:
+            return
+
+        self._thumbnail = value
+
     def update(self, media):
         self.props.media = media
         self.props.album = utils.get_album_title(media)


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