Hi,

I'm sure some of you might have already written something like this, but I figured I'd post it in case not. I wrote this quickly now out of the desire to easily remotely control my empeg from my desk. At the moment I have to either open a web browser, figure out where I left the IR remote, or, heaven forbid, exert physical effort to reach my empeg's front panel.

It's a Bourne shell script that I've set my display manager to call when I type certain key combinations. Edit the CURL and EMPEG variables at the top to suit your situation.

Code:
#!/bin/sh

CURL="/usr/local/bin/curl -s"
EMPEG="http://empeg"
OP=$1

usage () {
	echo "Usage: $0 <pause|prev|next|volup|voldown|hush|power>" >/dev/stderr
	rm -f /tmp/empegctl.run
	exit 1
}

if [ -z "${OP}" ]; then usage; fi

# The run file and sleep is to handle
# many consecutive executions sanely.
if [ -f /tmp/empegctl.run ]; then
	echo "Found /tmp/empegctl.run -- another instance running" >/dev/stderr
	exit 1
fi

echo $$ >/tmp/empegctl.run
sleep 0.1

case ${OP} in
pause)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top.R'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top.R'
	;;
prev)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Left'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Left.R'
	;;
next)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Right'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Right.R'
	;;
volup)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=KnobRight'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=KnobRight.R'
	;;
voldown)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=KnobLeft'
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=KnobLeft.R'
	;;
hush)
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Play'
	sleep 1
	${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Play.R'
	;;
power)
	STATE=$( ${CURL} ${EMPEG}'/proc/empeg_power' |grep "Display" |cut -c 1 )
	if [ "${STATE}" = "0" ]; then
		${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Bottom'
		${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Bottom.R'
	else
		${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top'
		sleep 1
		${CURL} ${EMPEG}'/?NODATA&BUTTONRAW=Top.R'
	fi
	;;
*)
	echo "Unknown operation: ${OP}" >/dev/stderr
	usage
	;;
esac

rm -f /tmp/empegctl.run