Song: Don't print empty song generally

This commit is contained in:
Michael Straube 2017-01-05 14:50:39 +01:00
parent 286b343a89
commit 8e32dc78f7
1 changed files with 5 additions and 3 deletions

View File

@ -1251,15 +1251,15 @@ get_song() {
;;
"banshee"*)
song="$(banshee --query-artist --query-title | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
song="$(banshee --query-artist --query-title | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')"
;;
"amarok"*)
song="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
song="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')"
;;
"pragha"*)
song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')"
;;
"exaile"*)
@ -1268,6 +1268,8 @@ get_song() {
;;
esac
[[ "$(trim "$song")" = "-" ]] && unset -v song
# Display Artist and Title on separate lines.
if [[ "$song_shorthand" == "on" ]]; then
artist="${song/ -*}"