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



commit 4acb23a3aef40db12cf6dbabae2978334d6a16a7
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 65b68718..84895363 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -100,6 +100,20 @@ def get_song_artist(item):
             or "")
 
 
+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: string
+    """
+    return (item.get_album_artist()
+            or "")
+
+
 def get_media_title(item):
     """Returns the title of the media item.
 


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