Last active
August 29, 2015 14:02
-
-
Save n-st/1e658115a24af3c645a8 to your computer and use it in GitHub Desktop.
Display title, artist and station via the default notification tool when pianobar starts playing a new song.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Modify the following line for your system and add it to your pianobar config | |
# (usually ~/.config/pianobar/config): | |
# event_command = /home/johndoe/bin/pianobar-event.sh | |
[ "$1" = "songstart" ] || exit 0 | |
while read line | |
do | |
for name in title artist stationName songStationName | |
do | |
value=$(echo $line | grep -oP '(?<=^'$name'=).+' 2>/dev/null) | |
[ -n "$value" ] && declare $name="$value" | |
done | |
done | |
station="$songStationName" | |
[ -z "$station" ] && station="$stationName" | |
notify-send "▶ $title" " by $artist\n on $station" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment