[gnome-music/wip/carlosg/tracker3: 50/55] utils: Add a getter for album artist




commit 93142df64b7a26233f9066d5e1f4bcde4de61e5d
Author: Jean Felder <jfelder src gnome org>
Date:   Mon May 18 18:26:23 2020 +0200

    utils: Add a getter for album artist
    
    Unlike `get_artist_name`, it does not take into account, the artist of
    the song.

 gnomemusic/utils.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index f5d62082..fef2ac3e 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -102,6 +102,20 @@ def get_artist_name(item):
             or _("Unknown Artist"))
 
 
+def get_album_artist(item):
+    """Returns the album artist of a song.
+
+    Unlike `get_artist_name`, it does not fallback to the artist of
+    the song if the album artist is not set.
+
+    :param Grl.Media item: A Grilo Media object
+    :return: The song artist name
+    :rtype: str
+    """
+    return (item.get_album_artist()
+            or "")
+
+
 def get_song_artist(item):
     """Returns the artist of a song.
 


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