From 72710f69444825005e6ab28894504450519cf59f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 9 Jan 2017 00:41:55 -0500 Subject: [PATCH] shell/mpd/bin/notify-song.sh: add fallbacks for artist/album/title --- shell/mpd/bin/notify-song.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/mpd/bin/notify-song.sh b/shell/mpd/bin/notify-song.sh index d30fa0d9..405686ef 100755 --- a/shell/mpd/bin/notify-song.sh +++ b/shell/mpd/bin/notify-song.sh @@ -15,11 +15,15 @@ artist=$(awk -F';' '{ print $2 }' <<<"$info") album=$(awk -F';' '{ print $3 }' <<<"$info") title=$(awk -F';' '{ print $4 }' <<<"$info") +artist="${artist:-No Artist}" +album="${artist:-No Album}" +title="${artist:-Untitled}" + case $OSTYPE in darwin*) terminal-notifier -title "$title" -message "by $artist :: $album" -appIcon "/Applications/iTunes.app/Contents/Resources/iTunes.icns" ;; linux*) - notify-send --icon="media-playback-start" --app-name="ncmpcpp" "$title" "$artist\n$album" + notify-send --icon="media-playback-start" --app-name="ncmpcpp" "$title" "${artist}\n${album}" ;; esac