31 lines
423 B
Bash
31 lines
423 B
Bash
#!/bin/bash
|
|
|
|
APPDIR="$HOME/.ocarina"
|
|
if [ "%DEBUG" == "True" ]; then
|
|
APPDIR="$APPDIR-debug"
|
|
fi
|
|
|
|
function write_to_pipe
|
|
{
|
|
pipe=$APPDIR/pipe
|
|
if [ -p $pipe ]; then
|
|
echo "$*" > $pipe
|
|
fi
|
|
}
|
|
|
|
case $1 in
|
|
next|pause|play|prev|stop|toggle)
|
|
write_to_pipe $1
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
cmd=`which ocarina-$1 2>/dev/null`
|
|
args="${@: +2}"
|
|
if [ "$cmd" ]; then
|
|
$cmd "$args"
|
|
else
|
|
cmd=`readlink -f $0`
|
|
`dirname $cmd`/ocarina-player "$*"
|
|
fi
|