[gnome-music/wip/jfelder/songeditor-gtk4: 72/76] utils: Add a getter for album artist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/songeditor-gtk4: 72/76] utils: Add a getter for album artist
- Date: Wed, 23 Feb 2022 20:36:45 +0000 (UTC)
commit fc5911a4b79f626ad1d30422545fa9ed838628db
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 85606ae8c..2a73f7f32 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -113,6 +113,20 @@ def get_artist_name(item):
or _("Unknown Artist"))
+def get_album_artist(item: Grl.Media) -> str:
+ """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: Grl.Media) -> str:
"""Returns the artist of a song.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]