diff --git a/include/adapters/mpd.hpp b/include/adapters/mpd.hpp index 03cc2862..2a152b01 100644 --- a/include/adapters/mpd.hpp +++ b/include/adapters/mpd.hpp @@ -64,6 +64,7 @@ namespace mpd { operator bool(); string get_artist(); + string get_album_artist(); string get_album(); string get_title(); string get_date(); diff --git a/src/adapters/mpd.cpp b/src/adapters/mpd.cpp index e0acfce3..4a5438ad 100644 --- a/src/adapters/mpd.cpp +++ b/src/adapters/mpd.cpp @@ -85,6 +85,12 @@ namespace mpd { return string{tag != nullptr ? tag : ""}; } + string mpdsong::get_album_artist() { + assert(m_song); + auto tag = mpd_song_get_tag(m_song.get(), MPD_TAG_ALBUM_ARTIST, 0); + return string{tag != nullptr ? tag : ""}; +} + string mpdsong::get_album() { assert(m_song); auto tag = mpd_song_get_tag(m_song.get(), MPD_TAG_ALBUM, 0); diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index 08fd1f7e..13c4b678 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -206,6 +206,7 @@ namespace modules { } string artist; + string album_artist; string album; string title; string date; @@ -223,6 +224,7 @@ namespace modules { if (song && song.get()) { artist = song->get_artist(); + album_artist = song->get_album_artist(); album = song->get_album(); title = song->get_title(); date = song->get_date(); @@ -236,6 +238,7 @@ namespace modules { if (m_label_song) { m_label_song->reset_tokens(); m_label_song->replace_token("%artist%", !artist.empty() ? artist : "untitled artist"); + m_label_song->replace_token("%album-artist%", !album_artist.empty() ? album_artist : "untitled album artist"); m_label_song->replace_token("%album%", !album.empty() ? album : "untitled album"); m_label_song->replace_token("%title%", !title.empty() ? title : "untitled track"); m_label_song->replace_token("%date%", !date.empty() ? date : "unknown date");