[gnome-music/wip/mschraal/utils-album-title-unknown: 10/10] utils: Improve album title retrieval



commit 6d70c0dcd12d20054b79c09d73f8c6d40df824c5
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Mar 29 23:26:55 2019 +0100

    utils: Improve album title retrieval
    
    A Grl.Media can be a container or a specific media item. In the latter case
    if there was no album title tag, the fallback would be the filename. This
    would result in two columns potentially having the same value in Songs
    view.
    Instead return "Unknown album" if the tag is not available.

 gnomemusic/utils.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index 468238da..bae746e7 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -49,10 +49,11 @@ def get_album_title(item):
     :return: The album title
     :rtype: string
     """
-    album = item.get_album()
-
-    if not album:
+    if item.is_container():
         album = get_media_title(item)
+    else:
+        album = (item.get_album()
+                 or _("Unknown album"))
 
     return album
 


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