[gnome-music/wip/mschraal/default-icon-cleanups: 25/25] albumwidget: Hide year if not available




commit 0baf7a0374601681635ab3c6ccf7b3cf23898f62
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Aug 27 22:24:30 2021 +0200

    albumwidget: Hide year if not available

 gnomemusic/widgets/albumwidget.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 4391fae2c..6cc1fca00 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -234,10 +234,15 @@ class AlbumWidget(Handy.Clamp):
             return
 
         mins = (self._corealbum.props.duration // 60) + 1
+        mins_text = ngettext("{} minute", "{} minutes", mins).format(mins)
         year = self._corealbum.props.year
-        release_info_label = ngettext(
-            "{}, {} minute", "{}, {} minutes", mins).format(year, mins)
-        self._released_label.props.label = release_info_label
+
+        if year == "----":
+            label = mins_text
+        else:
+            label = f"{year}, {mins_text}"
+
+        self._released_label.props.label = label
 
     def _play(self, coresong: Optional[CoreSong] = None) -> None:
         signal_id = 0


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