Since uPnP has no authentication, make sure you run the CH3WNAS behind a NAT router!
Those are the steps to setup MediaTomb on the CH3WNAS:
- Download the mediatomb build for the ppc-platform:
http://downloads.sourceforge.net/mediatomb/mediatomb-static-0.11.0-r1-linux-uclibc-ppce300c2.tar.gz
(or, to get the latest version, surf to http://mediatomb.cc/pages/download#static and then click on the latest mediatomb-static*-ppc*tar.gz file) - unzip the tar.gz and ftp (e.g. with gftp) the full mediatomb-directory to the CH3WNAS under HD_a2 (= /mnt/HD_a2/ on the device)
- telnet to the device (scroll down in my previous post for fun_plug'in and enabling telnet)
- make executable:
chmod 775 /mnt/HD_a2/mediatomb/usr/bin/mediatomb - chmod mediatomb.sh for easier ftp(*):
chmod 777 /mnt/HD_a2/mediatomb/mediatomb.sh - edit (e.g. with ftp mediatomb.sh to start mediatomb as daemon +fix LAUNCHDIR bug):
#!/bin/sh
# if you want to launch this script from a different directory (for example
# from an another init script or similar, set the LAUNCHDIR variable below
# to the absolute path of the mediatomb.sh script
#LAUNCHDIR=`pwd`
LAUNCHDIR=/mnt/HD_a2/mediatomb
rm -f $LAUNCHDIR/mediatomb.log
export MEDIATOMB_DATADIR="$LAUNCHDIR/usr/share/mediatomb"
export MEDIATOMB_MAGIC_FILE="$LAUNCHDIR/usr/share/file/magic"
$LAUNCHDIR/usr/bin/mediatomb -m $LAUNCHDIR -f config -d -l $LAUNCHDIR/mediatomb.log
!! Remark: Make sure the script is Unix-encoded (single \n for line-breaks), otherwise you'll get a "-ash /mnt/hd_a2/mediatomb/mediatomb.sh" error. try this command to translate the linebreaks:/mnt/HD_a2/busybox dos2unix /mnt/HD_a2/mediatomb/mediatomb.sh > /mnt/HD_a2/mediatomb/mediatomb.sh.new
mv /mnt/HD_a2/mediatomb/mediatomb.sh.new /mnt/HD_a2/mediatomb/mediatomb.sh - a first run will create the config.xml:
/mnt/HD_a2/mediatomb/mediatomb.sh
then run kill `pidof mediatomb` to stop the daemon - for easier editing of the config.xml (*):
chmod 666 /mnt/HD_a2/mediatomb/config/config.xml - now modify (ftp) the newly created /mnt/HD_a2/mediatomb/config/config.xml in order to add a fixed ipadres or interface and optional port.
<server>
...
<name>Michael's MediaTomb</name>
<udn>...</udn>
<ip>192.168.1.30</ip>
<port>50505</port>
<!-- or define port <interface>br0</interface> -->
<home>/mnt/HD_a2/mediatomb/config</home>
...
<protocolInfo extend="yes"/>
...
<!-- add extra mappings for jpeg / mpeg -->
<map from="JPG" to="image/jpeg"/>
<map from="jpg" to="image/jpeg"/>
<map from="mpg" to="video/mpeg"/>
<map from="m4a" to="audio/mpeg"/>
...The config.xml is well-documented at http://mediatomb.cc/pages/documentation#id2536421. Check out the docs in order to support for example PS3 connections.
- for auto-startup, you can add the following lines your fun_plug:
...
#kill legacy upnp
kill -9 `pidof upnp`
#start mediatomb
/mnt/HD_a2/mediatomb/mediatomb.sh
As you can see, I still run firefly, because I couldn't get a uPnP client working in Ubuntu (Rhythmbox). - after startup, connect to MediaTomb for configuring the directories to watch: (e.g.) http://192.168.1.30:50505/
update 9/7/2008: fixed the config for serving jpeg (see comments below) / using correct 'magic' files. If you used a previous version of this post, delete the bogus config.xml and mediatomb.db* files and follow the steps starting with fixing mediatomb.sh.
(*) Close this small security hole: revert to the original protection with a chmod 440 or 550 afterwards. Of course, with telnet and upnp enabled, you'd better keep the CH3WNAS behind a NAT router.
19 comments:
Thanks for the tutorial, it works!
But it looks like mediatomb is running multiple times. Is it normal?
Here is my process list:
PID Uid VmSize Stat Command
1 root 216 S init
2 root SW [keventd]
3 root SWN [ksoftirqd_CPU0]
4 root SW [kswapd]
5 root SW [bdflush]
6 root SW [kupdated]
8 root SW [mtdblockd]
9 root SW [khubd]
33 root SW [loop0]
364 root 264 S /usr/sbin/chkbutton
365 root 628 S /web/webs
368 root 256 S /bin/atd
382 root 644 S smbd -D
384 root 672 S nmbd -D
426 root 216 S /bin/op_server 6 6 6
483 root 212 S -sh
495 root 308 S crond
551 root 280 S ftpd: accepting connections on port 21
595 root 124 S /mnt/HD_a2/busybox telnetd
600 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
601 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
602 root 3900 R /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
605 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
607 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
609 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
611 root 3900 R /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
612 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
613 root 1252 S smbd -D
614 root 228 S -ash
622 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
632 root 3900 S /mnt/HD_a2/mediatomb/usr/bin/mediatomb -m /mnt/HD_a2/mediatomb -f config -d -l /mnt/HD_a2/mediatomb/mediatomb.log
634 root 308 R ps
The multiple processes are child- (forked) processes of the main mediatomb run.
The busybox ps command doesn't show those, but by looking into /proc/pid/status, you can find the Parent process.
The following script demonstrates this:
cd /proc
grep Name */status | grep mediatomb | /mnt/HD_a2/busybox cut -d ':' -f 1 | while read a
do
echo "/proc/$a $(grep PPid $a)"
done
result:
/proc/1373/status PPid: 750
/proc/1405/status PPid: 750
/proc/747/status PPid: 1
/proc/750/status PPid: 747
/proc/751/status PPid: 750
/proc/754/status PPid: 750
/proc/756/status PPid: 750
/proc/760/status PPid: 750
/proc/761/status PPid: 750
--> subprocesses hang under the main 747 / 750 pid.
Thanks for the instructions, mediatomb is running now on my CH3WNAS. With the firmware update to 1.05, the built-in UPNP Server of the CH3WNAS did not update the contents anymore, so I went for mediatomb. Unfortunately, Mediatomb does not work as expected with my Playstation 3. Although I set the parameters protocolInfo extend="yes" and map from="avi" to="video/divx", most of my divx movies are not working. The worst thing however is that none of my JPG pictures are displayed / found. They are also not listed in the Mediatomb GUI in the folder All Photos. So I suspect there is a misconfiguration of Mediatomb.
Regarding the charset, I needed to leave them on default and not changing to UTF-8. Otherwise German umlaut Characters (äöüß) are not displayed correctly.
map from="JPG" to="image/jpeg"/
Adding this parameter fixed the problem of not being able to display JPG files.
i also added following
map from="mpg" to="video/mpeg"/
map from="m4a" to="audio/mpeg"
thanks for you feedback. I tried to integrate your comments in an updated version of this blogpost.
I also fixed a problem with finding the 'magic' files.
Hi Michael,
did you try to run Mediatomb with the new firmware 1.05 from conceptronic? With the new firmware I experience problems on auto scanning the upnp directory. New files / changes are not automatically updated in the upnp database although I specified an update interval of 1800 sec in mediatomb.
Apparently, this is not a problem of mediatomb as conceptronic's integrated upnp server does not automatically update either. Do you have 1.05 installed? Could you please verify that?
Thanks
Markus
Markus,
I still have v1.04 installed. I'll try to upgrade and report back.
I must admit I don't update my media files often. After fixing my original config settings (correct the bad 'magic' directory / missing jpg's) I couldn't make mediatomb detect the jpgs. I had to remove the mediatomb.db first.
Michael
From Conceptronic support:
Dear Markus,
Thank you for making us aware of this issue.
We have forwarded this to our R&D department and they have already gave us a
new firmware which fixes this problem.
This should be released today (Tuesday) or tomorrow (Wednesday) after some
more internal testing.
Thanks once again we always appreciete when people come forward with their
problems so we can fix them!
Thanx for the clear tutorial. It works, but I've one little problem.
The tracks are always played in random order. Even when I created a playlist, it doesn't follow the order of the playlist. Very annoying.
Do you know what I can do to fix this ?
I must admit I don't use the upnp server a lot for now.
Make sure you have the latest ch3wnas firmware installed. If your problem persists, perhaps you should check out the Mediatomb forums.
I'll let you know if I investigate the UPnP playlists further.
About my problem with the playing order: that was not a problem.
My mediaplayer (MusicPal) was turned to random playing, accidently.
Sorry. Thanx for your reply.
Every time I try to run mediatomb.sh for the first time, I get
"-ash: //mnt/HD_a2/mediatomb/mediatomb.sh: not found"
I was able to Telnet into the device and chmod the files in the first steps. I verified those permissions via FTP, so the telnet is working.
It allows me to chmod mediatomb.sh, but when I type:
"/mnt/HD_a2/mediatomb/mediatomb.sh"
I get:
-ash: /mnt/HD_a2/mediatomb/mediatomb.sh: not found
What am I doing wrong?
I must note I'm using a D-Link DSM-G600 , not a CH3WNAS
Current Firmware Version : 1.02
Firmware Date : 10/19/2006
Would CH3WNAS firmware work on the DSM-G600?
@Greg:
- the firmware of CH3WNAS and DSM-G600 is somewhat different because of some different hardware config.
- the mediatomb.sh must be unix-encode (single \n for line-breaks)
try this command to translate the linebreaks:
/mnt/HD_a2/busybox dos2unix /mnt/HD_a2/mediatomb/mediatomb.sh > /mnt/HD_a2/mediatomb/mediatomb.sh.new
mv /mnt/HD_a2/mediatomb/mediatomb.sh.new /mnt/HD_a2/mediatomb/mediatomb.sh
Mediatomb runs well on my CH3WNAS but the initial indexing step was awfully slow, it needed 7 days for 15000 MP3 files.
Bye,
Jan
Thanx, I can see MediaTomb at my Netgear. But I've still a problem. I can't create a database.
My Mediatomb logfile shows:
2008-10-22 16:20:52 INFO: database created successfully.
2008-10-22 16:20:52 INFO: Initialized port: 50505
2008-10-22 16:20:52 INFO: Server bound to: 192.168.5.3
2008-10-22 16:20:53 WARNING: magic_load: could not find any magic files!
2008-10-22 16:20:53 INFO: MediaTomb Web UI can be reached by following this link:
2008-10-22 16:20:53 INFO: http://192.168.5.3:50505/
At the http site a see the database and the filesystem, but the filesystem shows online mediatomb files.
I hope you can you me.
The config.xml and the config directory doesn´t create for me , i run /mnt/HD_a2/mediatomb/mediatomb.sh and nothing´s happened , the # dont return any error msg but i cant kill with kill `pidof mediatomb` , give me a usage list post . Can you help me ? What command is use to PID List ???
Thx and sorry for my bad english :S
Finally i´ve run mediatomb , the mediatomb.sh issue are solved with a dos2unix converter for win32 named "DOS2UNIX" . Now i am going to configure trasconding for the ps3 if it is possible.
Dears
Please update your post with info how to install latest version 0.12.1
Thank you
Post a Comment