[gnome-music/wip/mschraal/assorted-art-fixes: 7/11] Drop loading state from art




commit d87818ef0e1894405c4d8a1791bc4ba14b4526a9
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Nov 11 23:32:06 2020 +0100

    Drop loading state from art
    
    related: #423

 gnomemusic/albumart.py   |  2 +-
 gnomemusic/artcache.py   | 14 ++------------
 gnomemusic/artistart.py  |  2 +-
 gnomemusic/corealbum.py  |  6 +++---
 gnomemusic/coreartist.py |  6 +++---
 gnomemusic/coresong.py   |  6 +++---
 gnomemusic/mpris.py      |  2 +-
 gnomemusic/songart.py    |  2 +-
 8 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/gnomemusic/albumart.py b/gnomemusic/albumart.py
index 2d3f14eb3..70d4aec32 100644
--- a/gnomemusic/albumart.py
+++ b/gnomemusic/albumart.py
@@ -64,7 +64,7 @@ class AlbumArt(GObject.GObject):
             self._artist, self._album, "album")
         if (not success
                 or not thumb_file.query_exists()):
-            self._corealbum.props.thumbnail = "loading"
+            self._corealbum.props.thumbnail = "generic"
             return False
 
         self._corealbum.props.thumbnail = thumb_file.get_uri()
diff --git a/gnomemusic/artcache.py b/gnomemusic/artcache.py
index d22ae44c8..a42355dea 100644
--- a/gnomemusic/artcache.py
+++ b/gnomemusic/artcache.py
@@ -122,12 +122,10 @@ def _make_icon_frame(
 
 
 class DefaultIcon(GObject.GObject):
-    """Provides the symbolic fallback and loading icons."""
+    """Provides the symbolic fallback icons."""
 
     class Type(Enum):
         ARTIST = "avatar-default-symbolic"
-        ARTIST_LOADING = "content-loading-symbolic"
-        LOADING = "content-loading-symbolic"
         MUSIC = "folder-music-symbolic"
 
     _cache: Dict[
@@ -193,7 +191,6 @@ class ArtCache(GObject.GObject):
 
         self._coreobject = None
         self._default_icon = None
-        self._loading_icon = None
 
     def query(self, coreobject):
         """Start the cache query
@@ -203,22 +200,15 @@ class ArtCache(GObject.GObject):
         self._coreobject = coreobject
 
         if isinstance(coreobject, CoreArtist):
-            self._loading_icon = DefaultIcon().get(
-                DefaultIcon.Type.ARTIST_LOADING, self._size, self._scale, True)
             self._default_icon = DefaultIcon().get(
                 DefaultIcon.Type.ARTIST, self._size, self._scale, True)
         elif (isinstance(coreobject, CoreAlbum)
                 or isinstance(coreobject, CoreSong)):
-            self._loading_icon = DefaultIcon().get(
-                DefaultIcon.Type.LOADING, self._size, self._scale)
             self._default_icon = DefaultIcon().get(
                 DefaultIcon.Type.MUSIC, self._size, self._scale)
 
         thumbnail_uri = coreobject.props.thumbnail
-        if thumbnail_uri == "loading":
-            self.emit("result", self._loading_icon)
-            return
-        elif thumbnail_uri == "generic":
+        if thumbnail_uri == "generic":
             self.emit("result", self._default_icon)
             return
 
diff --git a/gnomemusic/artistart.py b/gnomemusic/artistart.py
index 9cb0e3c62..7461bd823 100644
--- a/gnomemusic/artistart.py
+++ b/gnomemusic/artistart.py
@@ -52,7 +52,7 @@ class ArtistArt(GObject.GObject):
             self._artist, None, "artist")
         if (not success
                 or not thumb_file.query_exists()):
-            self._coreartist.props.thumbnail = "loading"
+            self._coreartist.props.thumbnail = "generic"
             return False
 
         self._coreartist.props.thumbnail = thumb_file.get_uri()
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index 665e86606..9ce98772a 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -137,11 +137,11 @@ class CoreAlbum(GObject.GObject):
     def thumbnail(self):
         """Album art thumbnail retrieval
 
-        :return: The album art uri or "generic" or "loading"
+        :return: The album art uri or "generic"
         :rtype: string
         """
         if self._thumbnail is None:
-            self._thumbnail = "loading"
+            self._thumbnail = "generic"
             AlbumArt(self._application, self)
 
         return self._thumbnail
@@ -150,6 +150,6 @@ class CoreAlbum(GObject.GObject):
     def thumbnail(self, value):
         """Album art thumbnail setter
 
-        :param string value: uri, "generic" or "loading"
+        :param string value: uri or "generic"
         """
         self._thumbnail = value
diff --git a/gnomemusic/coreartist.py b/gnomemusic/coreartist.py
index 0334c370d..4da047190 100644
--- a/gnomemusic/coreartist.py
+++ b/gnomemusic/coreartist.py
@@ -111,11 +111,11 @@ class CoreArtist(GObject.GObject):
     def thumbnail(self):
         """Artist art thumbnail retrieval
 
-        :return: The artist art uri or "generic" or "loading"
+        :return: The artist art uri or "generic"
         :rtype: string
         """
         if self._thumbnail is None:
-            self._thumbnail = "loading"
+            self._thumbnail = "generic"
             ArtistArt(self._application, self)
 
         return self._thumbnail
@@ -124,6 +124,6 @@ class CoreArtist(GObject.GObject):
     def thumbnail(self, value):
         """Artist art thumbnail setter
 
-        :param string value: uri, "generic" or "loading"
+        :param string value: uri or "generic"
         """
         self._thumbnail = value
diff --git a/gnomemusic/coresong.py b/gnomemusic/coresong.py
index 862cb66a5..064a6f8d7 100644
--- a/gnomemusic/coresong.py
+++ b/gnomemusic/coresong.py
@@ -131,11 +131,11 @@ class CoreSong(GObject.GObject):
     def thumbnail(self) -> str:
         """Song art thumbnail retrieval
 
-        :return: The song art uri or "generic" or "loading"
+        :return: The song art uri or "generic"
         :rtype: string
         """
         if self._thumbnail is None:
-            self._thumbnail = "loading"
+            self._thumbnail = "generic"
             SongArt(self._application, self)
 
         return self._thumbnail
@@ -144,7 +144,7 @@ class CoreSong(GObject.GObject):
     def thumbnail(self, value: str) -> None:
         """Song art thumbnail setter
 
-        :param string value: uri, "generic" or "loading"
+        :param string value: uri or "generic"
         """
         self._thumbnail = value
 
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 8a8b90c9d..ddb54a740 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -376,7 +376,7 @@ class MPRIS(DBusInterface):
             metadata['xesam:trackNumber'] = GLib.Variant('i', track_nr)
 
         art_url = coresong.props.thumbnail
-        if art_url not in ["generic", "loading"]:
+        if art_url != "generic":
             metadata['mpris:artUrl'] = GLib.Variant('s', art_url)
 
         return metadata
diff --git a/gnomemusic/songart.py b/gnomemusic/songart.py
index 450d59add..3311c42f7 100644
--- a/gnomemusic/songart.py
+++ b/gnomemusic/songart.py
@@ -64,7 +64,7 @@ class SongArt(GObject.GObject):
             self._artist, self._album, "album")
         if (not success
                 or not thumb_file.query_exists()):
-            self._coresong.props.thumbnail = "loading"
+            self._coresong.props.thumbnail = "generic"
             return False
 
         self._coresong.props.thumbnail = thumb_file.get_uri()


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