[gnome-music/wip/jfelder/tracker3-rebased: 41/46] utils: Add a getter for album artist




commit 615c81ce18f32980750d98433cb657876b59e2d4
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]