Skip to content

Instantly share code, notes, and snippets.

@r35krag0th
Created November 13, 2012 02:54
Show Gist options
  • Save r35krag0th/4063675 to your computer and use it in GitHub Desktop.
Save r35krag0th/4063675 to your computer and use it in GitHub Desktop.
A cleaner PianoBar Controller; incomplete
#!/bin/zsh
ControlFile="$HOME/.config/pianobar/ctl"
IssueCommand() {
CommandToIssue=$1
#echo "Sending '$CommandToIssue'..."
echo -n $CommandToIssue > $ControlFile
}
case $1 in
p|pause|play)
IssueCommand 'p'
;;
love|l|+|up|thumbup)
IssueCommand '+'
;;
hate|ban|-|down|thumbdown)
IssueCommand '-'
;;
next|n)
IssueCommand 'n'
;;
tired|t)
IssueCommand 't'
;;
stop|quit|q)
IssueCommand 'q'
;;
exlain|e)
IssueCommand 'e'
;;
nextstation|ns)
IssueCommand 'ns'
;;
prevstation|previosstation|ps)
IssueCommand 'ps'
;;
switchstation|ss|switch)
IssueCommand 'ss'
## EXTRA LOGIC
;;
upcoming|queue|u)
IssueCommand 'u'
;;
history|h)
IssueCommand 'h'
;;
*)
echo 'Valid Commands: p/+/-/n/t/q/e/ns/ps/ss/u/h';
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment