Created
March 26, 2013 21:27
-
-
Save anonymous/5249438 to your computer and use it in GitHub Desktop.
shell script oneliner to next songs in a blacklist (but not explicitly ban them, so the blacklist can be easily toggled off)
assumes ctl fifo and out files were created in ~/.config/pianobar and that pianobar is talking to them (ie, you're using headless_pianobar)
also assumes a list of blacklisted songs is located at ~/.config/pianobar/blacklis…
This file contains hidden or 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
# as a one liner, just to say I told you so: | |
tail -f $HOME/.config/pianobar/out | sed 's/\x1b\[2K/\n/g' | gawk -v HOME="$HOME" ' BEGIN { i=0; while((getline line<"blacklist") > 0) songs[line]; } { for(song in songs) { if ( $0 == song ) { print "Skipping "song; print "n" > HOME"/.config/pianobar/ctl2"; } } } ' | |
# With whitespace to make it easier to read: | |
tail -f $HOME/.config/pianobar/out |\ | |
sed 's/\x1b\[2K/\n/g' |\ | |
gawk -v HOME="$HOME" ' | |
BEGIN{ | |
i=0 | |
while((getline line<"blacklist") > 0) | |
songs[line]; | |
} | |
{ | |
for(song in songs) { | |
if ( $0 == song ){ | |
print "Skipping "song; | |
print "n" > HOME"/.config/pianobar/ctl2"; | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment