Difference between revisions of "TwonkyVision UPnP MediaServer"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Precompiled Binary for LS-Pro (ARM9) and stock/modified firmware)
(Precompiled Binary for LS-Pro (ARM9) and stock/modified firmware)
Line 320: Line 320:
  
 
V4.2  
 
V4.2  
http://www.twonkyvision.com/Download/TwonkyMedia/index.html
+
 
 
http://www.twonkyvision.com/Download/4.2/twonkymedia-linkstation-pro.zip  
 
http://www.twonkyvision.com/Download/4.2/twonkymedia-linkstation-pro.zip  
  

Revision as of 22:11, 18 May 2007

twonky-banner03.gif

Contents

Twonkyvision

The TwonkyVision MediaServer enables you to share all your Music, Pictures and Videos throughout your home. It is available for many different platforms and interworks with a large variety of client devices including XBox 360™ and Sony PSP™. TwonkyMedia needs fewer resources and is faster than other UPnP Media Servers, but still provides more features which help the user to enjoy large media collections.

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
  3. Precompiled binary for the LS-Pro (ARM9)

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/twonkyvision /etc/rc.d/rc2.d/S99twonkyvision 
ln -s /etc/init.d/twonkyvision /etc/rc.d/rc6.d/K92twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc.d/rc0.d/K92twonkyvision

Freelink

ln -s /etc/init.d/twonkyvision /etc/rc2.d/S99twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc6.d/K92twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc0.d/K92twonkyvision

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.

LS1, LS HG owners should use the ppc-script
LS2 owners should use the mips-script
(there are different paths... /mnt/ vs. /mnt/hda/)


Create folder where Twonkyvision will run from according to script (you can alter this, but adjust the script too)

LS1,HG (ppc)

mkdir /mnt/share/twonkyvision

LS2 (mips)

mkdir /mnt/hda/share/twonkyvision

Save the corresponding script below as twonky and put it in the just created folder. LS1,HG (ppc)

cp /mnt/share/twonkyvision/twonky /etc/init.d/twonky
chmod 755 /etc/init.d/twonky

LS2 (mips)

cp /mnt/hda/share/twonkyvision/twonky /etc/init.d/twonky
chmod 755 /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/twonkyvision /etc/rc.d/rc2.d/S99twonkyvision 
ln -s /etc/init.d/twonkyvision /etc/rc.d/rc6.d/K92twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc.d/rc0.d/K92twonkyvision

Freelink

ln -s /etc/init.d/twonkyvision /etc/rc2.d/S99twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc6.d/K92twonkyvision
ln -s /etc/init.d/twonkyvision /etc/rc0.d/K92twonkyvision


ppc-script

#!/bin/sh

# description: Starts and stops the Twonkyvision mediaserver daemons
# used to serve uPnP music-pics-video files
# This script should be used for all ppc-based Linkstations
# pidfile: /var/run/mediaserver.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin 

tag=TwkMediaServer
facility=user.info

# Check that binary file exists
[ -f /mnt/share/twonkyvision/mediaserver ] || exit 0

################## START SECTION ####################

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/share/twonkyvision/
	./mediaserver -D
       logger -t ${tag} -p ${facility} -i 'Started the service: /mnt/share/twonkyvision/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

mips-script (LS2)

#!/bin/sh

# description: Starts and stops the Twonkyvision mediaserver daemons
# used to serve uPnP music-pics-video files
# this script should be used on the LS2
# pidfile: /var/run/mediaserver.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin 

tag=TwkMediaServer
facility=user.info

# Check that binary file exists
[ -f /mnt/hda/share/twonkyvision/mediaserver ] || exit 0

################## START SECTION ####################

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/hda/share/twonkyvision/
	./mediaserver -D
       logger -t ${tag} -p ${facility} -i 'Started the service: /mnt/hda/share/twonkyvision/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

Precompiled Binary for LS-Pro (ARM9) and Freelink

To get Twonky easily working, you need a running Freelink on you LS-Pro. All you have to do is to download the twonkymusic-armel-glibc-2.3.3.zip package from twonkyvision. Download and unzip it to a directory on the large partition (/mnt/disk1/). This directory will be the home-directory of the twonky-server.

Now you should have a look at the readme-File which is included in the zip-package. This File contains further instructions to get it running stable. Don't forget to edit the twonky config-file (you have to set the path to the twonky home-directory)!

Now you can start the server to do a first test: In the home-directory you'll find a shell script which will start the server for you. If everything works fine you should set symbolic links to the rc.d-directorys to get it startet automatically after system-boot.


Step-by-Step - Guide:

  1. you need a running Freelink
  2. Download Twonky for ARM-CPUs and extract it to the large partition
  3. Read carefully the included Linux-HowTo.txt
  4. Open twonkymedia.sh and edit the work-dir (path to twonky)
  5. Try starting the server manually ("./twonkymedia.sh start")
  6. Try to connect via Web-Browser (http://ip-of-ls:9000)
  7. create symbolic Link in /etc/rc2.d (Name: S99twonkyserver, Path to twonkymedia.sh)
  8. create symbolic Link in /etc/rc0.d (Name: K99twonkyserver, Path to twonkymedia.sh)
  9. Reboot - that's it :-)

Precompiled Binary for LS-Pro (ARM9) and stock/modified firmware

Twonkyvision has published a new version (4.3 [1]) this also works with the stock or a modified firmware if you've telnet access. Version 4.3 comes with an updater where you can enter IP and user account. The user is root with the appropriate password. Read the enclosed README! Thread: [2]

Step-by-Step - Guide:

  1. enable telnet and (re)set the root password
  2. have wget on your box (e.g. get (addons.tar[3]) on your box and untar it with "tar -C / -xzvf <path.to.addons.tar>"
  3. modify install.nas: RC=/etc/init.d/twonky
  4. start the installer, enter IP of your LSPro, user is root and the appropriate password

If you modified install.nas as above you'll have the script twonky in /etc/init.d afterwards. To start twonky during boot you have to include a call to this script in /etc/init.d/rcS. Using vi to do so is strongly recommended! The line that has to be included is exec_sh twonky. I suggest to use vi to do this. Only if you're absolutely desperate with the use of vi you should do a
echo "exec_sh twonky" >> /etc/init.d/rcS
But be sure to use this exact line, especially with the two ">>" are important otherwise you could delete the startup script /etc/init.d/rcS and that'd really mess your box up!

Old Versions of TwonkyVision

V4.2

http://www.twonkyvision.com/Download/4.2/twonkymedia-linkstation-pro.zip

Usefull Links http://www.twonkyvision.de/forum/viewtopic.php?t=2244