TwonkyVision UPnP MediaServer
From NAS-Central Buffalo - The Linkstation Wiki
m |
|||
| Line 1: | Line 1: | ||
| - | http://www.twonkyvision.de/banner/twonky-banner03.gif | + | {{Template:Articles}}http://www.twonkyvision.de/banner/twonky-banner03.gif |
== Twonkyvision == | == Twonkyvision == | ||
Revision as of 21:59, 20 July 2006
Contents |
Twonkyvision
There are different ways to install Twonky onto the Linkstation
- The installer that comes with V3.1
- Frenchy's script from Yahoo Groups
Installer
You need telnet access enabled, so if you disabled it when you installed freelink, you need to
ln -s /etc/init.d/utelnetd /etc/rc2.d/S05utelnetd
Start NASSetup.exe and type your Linkstations IP then hit Send server- > NAS
Start the mediaserver
cd /etc/init.d ./twonkyvision start
Start and stop it at shutdown
Openlink
ln -s /etc/init.d/twonky /etc/rc.d/rc2.d/S99twonky ln -s /etc/init.d/twonky /etc/rc.d/rc6.d/K92twonky ln -s /etc/init.d/twonky /etc/rc.d/rc0.d/K92twonky
Freelink
ln -s /etc/init.d/twonkyvision /etc/rc2.d/S99twonky ln -s /etc/init.d/twonkyvision /etc/rc6.d/K92twonky ln -s /etc/init.d/twonkyvision /etc/rc0.d/K92twonky
Configure it on port 9000 on your Linkstation
http://<LinkstationIP>:9000
Frenchy script
Twonkyvision changed the name of the binaries from mediaserver to twonkymedia, this script looks for mediaserver,so , either alter the script or change the binary name.
LS2 owners will have to adjust the script to say /mnt/hda/media/Server.
Create folder where Twonkyvision will run from according to script (you can alter this, but adjust the script too)
mkdir /mnt/media/Server
Save the script below as twonky and put it in /mnt/media/Server
cp /mnt/media/Server/twonky /etc/init.d/twonky chmod 777 /etc/init.d/twonky
Test it to see if it works and it's in the correct place...
cd /etc/init.d ./twonky start
It should tell you that Twonkyvision has started and what version is running.
XP users should see a UpNP icon flash up saying a new device has been detected.
Issue top and see that twonky is shown running, if not check the script is where it should be and if you changed it that it is correct.
top
./twonky stop
Obviously stops it and nothing should be running
./twonky restart
Should stop all pids and say wait 20 secs
Once you're sure it's all working OK create these links:
Openlink
ln -s /etc/init.d/twonky /etc/rc.d/rc2.d/S99twonky ln -s /etc/init.d/twonky /etc/rc.d/rc6.d/K92twonky ln -s /etc/init.d/twonky /etc/rc.d/rc0.d/K92twonky
Freelink
ln -s /etc/init.d/twonky /etc/rc2.d/S99twonky ln -s /etc/init.d/twonky /etc/rc6.d/K92twonky ln -s /etc/init.d/twonky /etc/rc0.d/K92twonky
script
#!/bin/sh
# description: Starts and stops the Twonkyvision mediaserver daemons
# used to serve uPnP music-pics-video files
# Sam.
# pidfile: /var/run/mediaserver.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin
tag=TwkMediaServer
facility=user.info
# Check that binary file exist
[ -f /mnt/media/Server/mediaserver ] || exit 0
################## START SECTION ####################
#chdir /opt
# /opt/mediaserver &
start()
{ ## Cleaning up processes left before start
/sbin/killall -q -s9 "mediaserver" > /dev/null
sleep 3
if [ -f /var/run/mediaserver.pid ] ;
then
logger -t ${tag} -p ${facility} -i 'ATTention: a var/run/pid was left behind
at stop time...'
echo "START: WARNING there was a /var/run/pid was left over running ..."
#/sbin/killall -q -s9 "mediaserver" > /dev/null
#sleep 3
rm -f /var/run/mediaserver.pid
else
echo "STARTING - NO staled PID found - Cleaning loop bypassed..."
fi
echo "DONE WITH THE START CLEANUP ..."
## Starting the server
echo "Starting the Twonky Mediaserver"
cd /mnt/media/Server/
./mediaserver -D
logger -t ${tag} -p ${facility} -i 'Started the service: /media/Server/mediaserver'
}
################## STOP SECTION ####################
# Need to find a better way to stop the server
# some pids are left behind showing some mediaserver processes dont just stop upon SIGTERM-
15 request
# Actually the server needs sometime to stop gracefully
stop()
{
echo "Stopping the Twonky Mediaserver"
/bin/kill $(cat /var/run/mediaserver.pid)
echo "Sent the killall Cmd to mediaserver processes..."
if [ -f /var/run/mediaserver.pid ] ;
then
echo "Removing Pid ..."
rm -f /var/run/mediaserver.pid
else
echo "NO pids needed to be removed ..."
fi
logger -t ${tag} -p ${facility} -i 'Stopped the MediaServer and removed pid'
echo "Waiting for 20 seconds for server activities to finish stopping ..."
sleep 20
}
################## RESTART SECTION ####################
restartlog()
{
echo "RESTARTING the Twonky Mediaserver!"
logger -t ${tag} -p ${facility} -i 'RESTARTING the MediaServer .... '
}
################## SCRIPT COMMANDS ####################
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restartlog
stop
start
;;
*)
echo "Usage: cd /etc/init.d THEN ./twonky {start|stop|restart}" >&2
exit 1
;;
esac
exit 0

