#!/ffp/bin/sh

# PROVIDE: twonky
# REQUIRE: LOGIN

. /ffp/etc/ffp.subr
name="twonky"
start_cmd="twonky_start"
stop_cmd="twonky_stop"

twonky_start()
{
	route add -net 224.0.0.0 netmask 240.0.0.0 dev egiga0
	cd /ffp/opt/twonky
	mkdir -p /ffp/opt/twonky/data/ &
	# The line below is without logging (logs are written to /dev/null).
        # If you want logging, exchange it with the line below the current one.
        /ffp/opt/twonky/twonkymedia -logfile /dev/null -appdata /ffp/opt/twonky/data/ >/dev/null 2>/dev/null </dev/null &
        # /ffp/opt/twonky/twonkymedia -logfile /ffp/opt/twonky/data/TwonkyMediaServer-log.txt -appdata /ffp/opt/twonky/data/ >/dev/null 2>/dev/null </dev/null &
}

twonky_stop()
{
	killall twonkymedia
	route del -net 224.0.0.0 netmask 240.0.0.0 dev egiga0
}

run_rc_command "$1"
