Skip to content

Instantly share code, notes, and snippets.

@n-st
Last active August 29, 2015 14:02
Show Gist options
  • Save n-st/1e658115a24af3c645a8 to your computer and use it in GitHub Desktop.
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.
#!/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