From 5c4d03eaa1b2d8ddf7e5fda50b48b650c68e9d26 Mon Sep 17 00:00:00 2001 From: William Ball Date: Fri, 30 May 2025 13:07:07 -0700 Subject: [PATCH] properly handle songs w/o album art --- pianobar/.config/pianobar/display_info.sh | 9 ++++++--- pianobar/.config/pianobar/event_command.sh | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pianobar/.config/pianobar/display_info.sh b/pianobar/.config/pianobar/display_info.sh index 5c87d6d..0c9498d 100755 --- a/pianobar/.config/pianobar/display_info.sh +++ b/pianobar/.config/pianobar/display_info.sh @@ -6,6 +6,9 @@ while read L; do export "$k=$v" done < <(grep -e '^\(title\|artist\|album\|stationName\|songStationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\|stationCount\|station[0-9]*\)=' "$HOME/.config/pianobar/info") -curl "$coverArt" --silent --output "$HOME/.config/pianobar/album.jpg" - -notify-send "Now playing:" "$title by $artist on $album" --icon="$HOME/.config/pianobar/album.jpg" +if [ -z "$coverArt" ]; then + notify-send "Now playing:" "$title by $artist on $album" +else + curl "$coverArt" --silent --output "$HOME/.config/pianobar/album.jpg" + notify-send "Now playing:" "$title by $artist on $album" --icon="$HOME/.config/pianobar/album.jpg" +fi diff --git a/pianobar/.config/pianobar/event_command.sh b/pianobar/.config/pianobar/event_command.sh index 53883d3..8860587 100755 --- a/pianobar/.config/pianobar/event_command.sh +++ b/pianobar/.config/pianobar/event_command.sh @@ -10,8 +10,12 @@ done < <(grep -e '^\(title\|artist\|album\|stationName\|songStationName\|pRet\|p case "$1" in songstart) - curl "$coverArt" --silent --output "$HOME/.config/pianobar/album.jpg" - notify-send "Now playing:" "$title by $artist on $album" --icon="$HOME/.config/pianobar/album.jpg" + if [ -z "$coverArt" ]; then + notify-send "Now playing:" "$title by $artist on $album" + else + curl "$coverArt" --silent --output "$HOME/.config/pianobar/album.jpg" + notify-send "Now playing:" "$title by $artist on $album" --icon="$HOME/.config/pianobar/album.jpg" + fi ;; *) ;;