Difference between revisions of "TwonkyVision UPnP MediaServer"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(this article is a general one...twonky can be installed on all telnet enabled devices)
Line 1: Line 1:
(not really Debian specific!!)
 
 
 
== Twonkyvision ==
 
== Twonkyvision ==
  
Line 127: Line 125:
 
  exit 0
 
  exit 0
 
   
 
   
[[Category:Debian]]
+
[[Category:General]]

Revision as of 21:58, 4 July 2006

Twonkyvision

There are different ways to install Twonky onto the Linkstation

  1. The installer that comes with V3.1
  2. 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

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

#!/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