Jump to content

Installing TwonkyMedia Server on cache drive


aht961

Recommended Posts

A guide for the beginner (from a beginner)

 

First of all read the previous threads concerning twonkymedia server installation on UnRAID:

#1) http://lime-technology.com/forum/index.php?topic=729.0

#2) http://lime-technology.com/forum/index.php?topic=6438.0

 

Background Info

 

After installing according to the #1, the server installs and runs. However, 2 serious problems occur. Firstly, the server installs from your /flash disk, but after the first run, the -ini file (twonkymedia-server.ini) and all your database are built and run at RAM under 2 directories "/twonkymedia" and "/var/twonkymedia". Secondly, after next reboot of your server, all your settings including the license number are gone and you need to start over. The solution to the problem of loosing license number and settings is suggested in #2 above, however, the database (music, video, photos), cache and all related data are lost once again and need to be built all over. I have checked few options and come to the following solution. In case if another novice needs to go through the same torture of "trial and error" step, these guides may prove handy. Do it on your own risk, though.

 

We will use cache drive and an invisible path to keep the inifile and all twonky related material untouched during a reoot. Instead of cache drive, I assume any another drive off the array (S.N.A.P. etc) can be used as well. (Your boot Flash disk too, but we will not be willing too many writes/deletes to the flash mount).

 

In Part 1, we will download, adjust and start using the TwonkyMedia server (version 6.0.32) as a uPnP and in Part 2 we will enable the background video transcoding options.

 

Part 1

 

XXXX PREPARE CACHE DRIVE XXXX

 

1. Make a directory at /mnt/cache with the name starting with a "." : e.g ".packages/twonkyserver" (/mnt/cache/.packages/twonkyserver)

 

Under this directory we will download the TwonkyMedia Server and reinstall from this directory after each reboot.

 

2. Make another dir at /mnt/cache/.packages/tms/twonkymedia

(In future, here we will keep the content of server's database and INI file - originally this path is /var/twonkymedia at RAM)

 

3. And another dir at /mnt/cache/.packages/twonkymedia

(In future, here we will keep the content of media - originally this path is /twonkymedia at RAM)

 

XXXX DOWNLOAD and INSTALL TWONKYMEDIA SERVER at your CACHE DRIVE XXXXXX

 

4. From http://www.twonkyvision.com/

Download the Linux x86(manual install) file, currently named "twonkymedia-i386-glibc-2.2.5-6.0.32.zip" (http://www.twonkyvision.com/upfiles/twonkymedia-i386-glibc-2.2.5-6.0.32.zip).

Unzip >> you will have "twonkymedia-i386-glibc-2.2.5-6.0.32". For the sake of brevity, change the name of this folder to "twonkyserver".

 

Copy TWONKYSERVER's content to your cache drive at /mnt/cache/.packages/twonkyserver" (remember we have created this #1), where you should have the following:

- cgi-bin

- initial_keystore.dat

- Linux-HowTo.txt

- plugins

- radio.m3u

- resources

- RevisionHistory

- twonkymedia

- twonkymedia-server-dafault.ini

- twonkymedia.sh

- twonkymediaserver

 

5. Give the correct privileges by using the following command in /mnt/cache/.packages/twonkyserver:

chmod 700 twonkym* cgi-bin/* plugins/*

 

 

XXXXXXXX FIRST RUN XXXXXXX

 

6. Open your GO script and add the following line (or use the command line):

"/mnt/cache/.packages/twonkyserver/twonkymedia/twonkymedia" and reboot your server.

 

7. Now you can make the necessary adjustments (defining the directories of the media, entering the license number and etc.) using the TwonkyMedia server web browser at "http://tower_or_its_IP:9000". Let it build the database and this can take an hour or two depending on how much media you have to share.

 

This could be the end of the story if we had not have the problems above (server runs at RAM and it will be cleared after next reboot). So we need to continue with the following.

 

XXXXXXXX COPY ALL DATABASE AND THE NEW INI FILE TO THE PERMANENT DIRECTORY at CACHE DISK XXXXX

 

Remember, we have already built the directories above ("/mnt/cache/.packages/tms/twonkymedia" and "/mnt/cache/.packages/twonkymedia"). Now we will do some copying!

 

8. Copy ALL from "/var/twonkymedia/" TO "/mnt/cache/.packages/tms/twonkymedia"

You need this command: cp -r /var/twonkymedia/* /mnt/cache/.packages/tms/twonkymedia/

 

9. Copy ALL from "/twonkymedia/" TO "/mnt/cache/.packages/twonkymedia"

You need this command: cp -r /twonkymedia/* /mnt/cache/.packages/twonkymedia/  

 

As a consequent, you should now have 3 subdirectories (music, picture, videos) at "/mnt/cache/.packages/twonkymedia"

and plenty under "/mnt/cache/.packages/tms/twonkymedia"

 

 

XXXXXXXX MODIFY THE SERVER.INI FILE ACCORDING TO YOUR LIKING XXXXXXX

 

After this step, following the next boot, your database, cache and all related will be built to your CACHE disk and the -ini file will be read from there.

 

10. Open the ini file "/mnt/cache/.packages/tms/twonkymedia/twonkymedia/twonkymedia-server.ini" with your editor and change a few lines (I will try to go trough these next). To be precise, 8 lines need to be modified:

 

# directory for cached/transcoded files

cachedir=/mnt/cache/.packages/tms/twonkymedia/twonkymedia/db/cache

 

# directory where metadata database is stored

dbdir=/mnt/cache/.packages/tms/twonkymedia/twonkymedia/db

 

# directory where server managed music folders are stored, like uploaded and mirrored songs, subfolder names are created based on strings from language files

servermanagedmusicdir=/mnt/cache/.packages/twonkymedia/music/TwonkyMedia

 

# directory where server managed picture folders are stored, like uploaded and mirrored photos, subfolder names are created based on strings from language files

servermanagedpicturedir=/mnt/cache/.packages/twonkymedia/pictures/TwonkyMedia

 

# directory where server managed video folders are stored, like uploaded and mirrored videos, subfolder names are created based on strings from language files

servermanagedvideodir=/mnt/cache/.packages/twonkymedia/videos/TwonkyMedia

 

# directory where downloaded online items are cached

onlinedir=/mnt/cache/.packages/tms/twonkymedia/twonkymedia/twonkymedia-server-online-data

 

# directory where statistics are stored

mediastatisticsdir=/mnt/cache/.packages/tms/twonkymedia/twonkymedia/media-statistics/

 

# removable media home drive

rmhomedrive=/mnt/cache/.packages/tms/twonkymedia/twonkymedia/db

 

 

XXXXXXXX ALMOST THERE XXXXXXXXXXXXX

 

We need to tell the application where the INI file is.

 

11. Change the start line in your GO script from (above #5)

"/mnt/cache/.packages/twonkyserver/twonkymedia" TO

"/mnt/cache/.packages/twonkyserver/twonkymedia -inifile /mnt/cache/.packages/tms/twonkymedia/twonkymedia/twonkymedia-server.ini"

 

Reboot. Wait the database to built (another one hour) go and fetch some coffee or beer! Hope this helps.

 

XXXXXXXX CLEAN SHUT DOWN XXXXXXXXXXX

 

In order to be able to start/stop the server and have the unRaid shut down/reboot we will use unMenu and the user scripts. Otherwise the unRaid willnot be able to unmount the drives since TMS will be using them. Go and get the included scripts here, remove the .txt suffix and drop them at /boot/unmenu. As a result you will have "Start Twonky" and "stop twonky" options at "users' scripts" page in unMenu.

 

2222-unmenu_user_script_start_twonkymedia.txt

2222-unmenu_user_script_stop_twonkymedia.txt

Link to comment

Is there a free Twonky version you can try? I'd like to try playing with this as well since I'm trying to setup a buddy with a PS3 and I didn't have the greatest luck with PS3MediaServer. Of course nothing says I can't try again, but I just haven't.

Link to comment

Is there a free Twonky version you can try? I'd like to try playing with this as well since I'm trying to setup a buddy with a PS3 and I didn't have the greatest luck with PS3MediaServer. Of course nothing says I can't try again, but I just haven't.

 

Yes - Twonky gives you a free trial (30 days, if I recall) before it requires a license key.  The trial is fully functional.

 

I also use it - not yet with the databases on the cache drive, but that looks like a good next step.  

 

@aht961 - many thanks for the info on setting that up.

 

Link to comment

Please refer to the FIRST message!

 

 

..

@aht961 - many thanks for the info on setting that up.

 

You're welcome.

I have tested the above setting and it is functioning as it was meant to. One "small" problem, though. While twonky is running, if you try to "reboot" the unRaid, it seems that it takes ages trying to unmount "/mnt/cache" drive and reboot fails.

 

I wrote two scripts (attached here). Remove the .txt suffix and put them in /boot/unmenu/. You will be able to run them using the "user scripts" in unMenu. The first one will start the twonkyserver and the other one will stop it properly so you can shut down the unRaid properly.

 

PS: I have edited this message. Therefore the following message by Joe is assuring that these scripts would do the job.

Link to comment

..

@aht961 - many thanks for the info on setting that up.

 

You're welcome.

I have tested the above setting and it is functioning as it was meant to. One "small" problem, though. While twonky is running, if you try to "reboot" the unRaid, it seems that it takes ages trying to unmount "/mnt/cache" drive and reboot fails.

Could some body write/suggest a small script which once needed could KILL the twonkymedia server properly, so unRaid could cleanly power down? This could then be added e.g. to the list of user scripts in unMenu. I could not find any option in the twonkymedia servers admin GUI where you could shut down the server (there is only an option to "restart" the server).

 

I am answering myself :( I wrote two scripts and added to /boot/unmenu.. Now, you can start and stop twonkymedia via the "user scrpts" page in unmneu. I enclose both here (remove the .txt suffix). Still would be very nice if an experienced linux member kindly checks/improves out the commands. Thank you.

 

 

They should work.
Link to comment

Part 2 - Installing FFMPEG

 

 

Background Info

 

If you have already installed ffmpeg and have it running, then this part is easy. If not, follow the following guides. As a left over from Windows installation, the ffmpeg path defined in original file "ffmpeg.location" (in /twonkyserver/cgi-bin/) is wrong. Just replace c:/ffmpeg with "usr/bin" and you will be fine. Restart the TMS and go to the admin GUI and you will see the video transcoding option available (mpeg2, flash, mpeg4 etc.). Otherwise they are all greyed out.

 

XXXXXX DOWNLOAD THE REQUIRED PACKAGES XXXXXX

 

There are various versions of ffmpeg and all dependent packages vary. Brit's nice and straight forward guides will make your life very easy. Thanks to BRIT. Read the original message here: http://lime-technology.com/forum/index.php?topic=3072.msg72895#msg72895. Including the ffmpeg, you need 13 packages to get this working. The URLs given in the older message have changed slightly, but if you go HERE you will find 12 of these 13. (The subdirectory name is given in parenthesis)

 

FFMPEG RELATED PACKAGES

 

1. alsa-lib-1.0.24.1-i486-1.txz (l)

2. glibc-solibs-2.13-i486-3.txz (a)

3. libX11-1.4.2-i486-1.txz (x)

4. libXau-1.0.6-i486-1.txz (x)

5. libXdmcp-1.1.0-i486-1.txz (x)

6. libXext-1.2.0-i486-1.txz (x)

7. libXfixes-5.0-i486-1.txz (x)

8. libogg-1.2.2-i486-1.txz (l)

9. libtheora-1-1.1.1-i486-1.txz (l)

10.libusb-1.0.8-i486-1.txz (l)

11. libxcb-1.7-i486-1.txz (x)

12. openssl-solibs-0.9.8r-i486-1.txz (a)

 

13. FFMPEG itself: ffmpeg-0.6.1-i486-1alien.tgz, get it from HERE - slackbuil 13.1, ffmpeg version 6.0.32.

 

XXXXX INSTALL ALL XXXXXX

 

Download the above packages within the same directory, cd to that path and issue:

installpkg * .txz - you will have all packages but ffmpeg installed, then

installpkg ffmpeg-0.6.1-i486-1alien.tgz - this will install the ffmpeg (usr/bin)

 

(Remember to add these to your go script - before TMS start line! -, so after each reboot, these are installed before the TMS starts).

 

XXXXXXX CHECK TO SEE IF YOU SUCCEEDED XXXXXXXXX

 

Type ffmpeg -version. You should see the version, copyright, help etc.

 

XXXXXXX ENABLING TRANSCODING IN TMS XXXXXXXX

 

Assuming that you have already defined the correct path mentioned earlier in ffmpeg.location (/usr/bin"). You are ready to go. Stop and start the twonky, and go to the admin GUI, you will notice that the transcoding options are not greyed any more and you can chose them.

 

XXXXXXX THAT'S IT XXXXX

 

The rest rquires some testing. I understood that the trasncoding does not take place on the fly (LIVE) but passively going through all available directories. That may take ages, though.

 

Regards.

 

 

Link to comment
  • 4 months later...

I want to thank you too for the helpfull guide.

 

But I have the problem that the Cache-Drive is not mounted at the time I like to start Twonky. The Twonky and the FFMpeg are the last lines in the go script but It didn't work, I have to start it manual over telnet.

 

Some ideas how to change that.

 

Furthermore I like to inform that the user scripts are somehow did not work for me. Unmenu seems not to find them.

Link to comment

I want to thank you too for the helpfull guide.

 

But I have the problem that the Cache-Drive is not mounted at the time I like to start Twonky. The Twonky and the FFMpeg are the last lines in the go script but It didn't work, I have to start it manual over telnet.

 

Some ideas how to change that.

 

Furthermore I like to inform that the user scripts are somehow did not work for me. Unmenu seems not to find them.

 

1) Put the start line towards the end of the GO script and add a 10 sec sleep command before it to make sure the cache drive is mounted.

e.g.

 

#sleep for 10 seconds

sleep 10

 

2) Did you remember to remove the "txt" suffix from the attached script files and give the correct privileges (that is: chmod +x)?

 

Link to comment
  • 2 weeks later...

Hello aht961,

 

thanks for the help. But with the script still don't work. I did what you describt also make a chmod with a reference file that work but the scripts didn't show up.

 

For the delay I will see if it work after the next boot.

 

Thanks for you help.

 

PS: I'm a Linux noob so I just can di what somebody or the help files decribed.

Link to comment
  • 3 months later...

I followed your guide but in the end I wasn't able to do what I was planning to. The iPhone app couldn't detect my Airport Express device, so streaming music to it wasn't possible. Moreover it was a pain in the ass to install and configure Twonky on the unRAID side. By the way, I can confirm that the start and stop unMENU scripts don't show up, at least with 5b14.

 

But thank you for your guide. I'll stick with AirVideo for video streaming and iPhone to Airport Express for music streaming (and so forgetting about streaming my entire library).

Link to comment
  • 3 weeks later...

Looking at this as an option, but with a twist

 

I am running unRaid in a VM and was looking at this option http://www.lime-technology.com/forum/index.php?topic=16270.0 where a disk is created for unRaid to boot from.  It would make sense to use this disk then for twonky instead of the cache drive (especially if you are not using a cache drive).

 

Now, I know very little about linux so what changes would need to be made to your proceedure in the first post to use the unraid boot drive instead of the cache drive.  Is it just a matter of changeing /mnt/cache to /mnt/sda

 

Mick

Link to comment

Is it just a matter of changeing /mnt/cache to /mnt/sda

 

According to the link to which you have referred to, it should be ok, if you install the twonky instead of cache, on your BOOT volume, which seems to be "/mnt/boot". In that case you should change "/mnt/cache/.packages/" to "/mnt/boot/" (you don't need ".packages" in between since the "boot" will not be in your array any way, so you don't need to hide the directory. ie tms and twonkymedia will be under /mnt/boot/).

Link to comment

Twonky ist Up and Running, but the Start / Stop Scripts are not displayed in UnMenu.

 

I'm not able to stop Twonky...

 

So I can't make a save Reboot...

 

What could be the problem, I'm sitting here now for hours trying to get this to work...

Link to comment

Twonky ist Up and Running, but the Start / Stop Scripts are not displayed in UnMenu.

 

I'm not able to stop Twonky...

 

So I can't make a save Reboot...

 

What could be the problem, I'm sitting here now for hours trying to get this to work...

I am not sure why the user scripts to start and stop the TMS are not working, however, you can stop it by doing the following:

- go and connect to your unRaid server using telnet or ssh

- issue the following commands (same lines as in the scripts):

 

echo "<pre>"

set -xv

av_pid=$(ps -ef | grep twonkymedia | grep -v grep | awk '{print$2}');

test "$av_pid" != "" && kill $av_pid

 

and you start by the following command:

echo "<pre>"

/mnt/cache/.packages/twonkyserver/twonkymedia -inifile /mnt/cache/.packages/tms/twonkymedia/twonkymedia/twonkymedia-server.ini

 

Please double check these with the scripts above:

- you have installed them in /boot/unmenu

- you have remembered to REMOVE the .txt suffix from both files. Consequently you should have "2222-unmenu_user_script_start_twonkymedia" and "2222-unmenu_user_script_stop_twonkymedia" in that directory. The leading number 2222 is not important, an number goes if it does not conflict with the other scripts of the unmenu

- you should make those both scripts executable by using chmod command. First go to the directory where your scripts are (1) and then issue the chmod command (2):

(1) cd /boot/unmenu/

(2) chmod +x 2222-unmenu_user_script_start_twonkymedia 2222-unmenu_user_script_stop_twonkymedia

 

 

Link to comment

Hello,

 

thanke You for Your reply.

 

But I can only start twonky with:

 

/mnt/cache/.packages/twonkyserver/twonkymedia/twonkymedia -inifile /mnt/cache/.packages/tms/twonkymedia/twonkymedia/twonkymedia-server.ini

 

I have the problem with all aditions scripts, they are not running.

 

But I can't figure out why...

 

My there is something with the editor i use or what ever....

 

Thane You for Your Help.

Link to comment

 

I have the problem with all aditions scripts, they are not running.

 

But I can't figure out why...

 

My there is something with the editor i use or what ever....

 

Thane You for Your Help.

 

What do you see whe you go to the scripts page of unmenu (http://yourUnRaidServername:8080/user_scripts)?

The first script should be HELLO WORLD. What happens when you click that button? You should see "Hello world" typed at the lower part of the same page. If you see that then the scripts should work, I assume. If you don't see that then you should probably ask in the unmenu thread.

Link to comment

Hi,

 

I see the Hello World.

But If I create a own script, nothing happens.

The built-in work but no aditional.

Not even, if i copy the Hello World script and change the output to test, and the name to 60_xxxxxx

Noting happens, when i klick the button. Thats the only thing that works, the buttons are displayed......

 

cu

Link to comment

Hi,

 

I see the Hello World.

But If I create a own script, nothing happens.

The built-in work but no aditional.

Not even, if i copy the Hello World script and change the output to test, and the name to 60_xxxxxx

Noting happens, when i klick the button. Thats the only thing that works, the buttons are displayed......

 

cu

Do you use "chmod +x" after you create the script?

Maybe the editor you use is not ok? Try to copy/duplicate a working script, do not open it with your editor, just rename it and try to see if it works.

Link to comment

I have postet my problem also in the MediaPlayer Forum, what I'm using the Server fore.

 

One of them was so kind, to do a test on his server.

The same problem there. also only the build in scripts are runnung.

 

If you check the rights with ls -l all have the same, the old and the new.

 

So i really don't know what causes this.... ???

 

BTW, I was trying a mp4 file via twonky, after about 10 to 15 minutes the playback starts to stutter, the frames are only jumping and the sound is hopping around.

 

Same File on a WB MyBook Live, also Twonky, same Player no problem.

Same File on my UnRaidServer, other Player that does not need a Server like Twonky, via SMB and NFS, no Problem.

 

cu

 

Link to comment

Try to copy/duplicate a working script, do not open it with your editor, just rename it and try to see if it works.

Did you try this without touching the script with your text editor?

Some unsuitable text editors or formats leave traces (carriage return / line feed) which you don't see but prevent the script to run.

Link to comment

I used this as a guide to getting my twonky running using the boot hard drive for UnRaid.  I am using unRaid in a VM and instead of booting form the USB, I boot from a virtual hard drive.

All appears to be working fine, except that wne I log onto the twonky server and go to shares I dont see any of the shares that I have created.  They still work when accessed via a media renderer, its just the web configuration itnerface that is not showing the correct info.  Is this a case of me getting something wrong when following the instructions or is it a known issue.  (I am still using the 30 day trial).

 

Mick

Link to comment

I used this as a guide to getting my twonky running using the boot hard drive for UnRaid.  I am using unRaid in a VM and instead of booting form the USB, I boot from a virtual hard drive.

All appears to be working fine, except that wne I log onto the twonky server and go to shares I dont see any of the shares that I have created.  They still work when accessed via a media renderer, its just the web configuration itnerface that is not showing the correct info.  Is this a case of me getting something wrong when following the instructions or is it a known issue.  (I am still using the 30 day trial).

 

Mick

Are you using samba USER shares? Accordingly, the correct path in twonky's settings GUI should be: /mnt/user/YOURSHARE. At least user shares do work. I am not quite sure about direct disk access.

Link to comment
  • 1 month later...

Hello,

 

I have a Twonky server running under Unraid v.5 beta14 for some time now.

All is fine thanks to the method described in this thread.

So fine indeed that I forgot the whole procedure details.

Now I would like to upgrade the Twonky server to its latest version.

What are the customized files I must save aside and restore after I unpack the new Twonky files?

 

Thank you

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...