Setting up – Mediatomb – UPnP media server on Debian.

I’m assuming mediatomb is installed and running.

Create database MediaTomb.

  • user: mediatombuser,
  • password: password,
  • Database name: mediatomb,

Log on to your MySQL as – root,

sudo mysql -u root -p
create user 'mediatombuser'@'localhost' identified by 'password';
create user 'mediatombuser'@'%' identified by 'password';
grant all on mediatomb.* to 'mediatombuser'@'localhost';
grant all on mediatomb.* to 'mediatombuser'@'%';
quit

Load mediatomb DB into MySQL.

sudo mysql mediatomb -u mediatomb -p < /usr/share/mediatomb/mysql.sql
sudo /etc/init.d/mediatomb restart

Edit configfile /etc/default/mediatomb.

sudo nano /etc/default/mediatomb

Change the default port for MediaTomb (default port – 49152):

OPTIONS="-p 50000"

Change the listening newtork interface for MediaTomb (eth1).
MediaTomb is listening on all network interfaces by default.

INTERFACE="eth1"

Edit configfile /etc/mediatomb/config.xml.

sudo nano /etc/mediatomb/config.xml
Enable Web Interface MediaTomb.
<ui enabled="yes" show-tooltips="yes">
Using MySQL.

I will be using MySQL (default mediatomb setup is sqlite)

...
<sqlite3 enabled="no">
<database-file>sqlite3.db</database-file>
</sqlite3>

<mysql enabled="yes">
<host>localhost</host>
<username>mediatombuser</username>
<password>password</password>
<database>mediatomb</database>
</mysql>
...
 Enable MediaTomb accounts

Accounts are disabled by default, to enable:

<accounts enabled="yes" session-timeout="30">
<account user="mediatomb" password="mediatomb"/>

Job done.

Now restart mediatomb service:

sudo /etc/init.d/mediatomb restart
[ ok ] Restarting upnp media server: mediatomb.

and go to http:/mydomain.net:50000 to configure media folders.

Compiling Mediatomb on Debian with Support for Samsung Smart TV

Patch and general info: http://sourceforge.net/p/mediatomb/patches/37/

Login as root and copy and paste the below:

apt-get install dpkg-dev devscripts fakeroot
 apt-get build-dep mediatomb
 apt-get source -d mediatomb
 dpkg-source -x mediatomb_0.12.1-0ubuntu4.dsc
 echo mediatomb-urifix.patch >> mediatomb-0.12.1/debian/patches/series
cat > mediatomb-0.12.1/debian/patches/mediatomb-urifix.patch << EOF --- a/tombupnp/upnp/src/genlib/net/uri/uri.c +++ b/tombupnp/upnp/src/genlib/net/uri/uri.c @@ -1042,7 +1042,8 @@ out->path_type = REL_PATH;
 }
- if( ( ( begin_hostport + 1 ) < max ) && ( in[begin_hostport] == '/' ) + //parse hostport only if scheme was found + if( ( begin_hostport > 0 ) && ( ( begin_hostport + 1 ) < max ) && ( in[begin_hostport] == '/' ) && ( in[begin_hostport + 1] == '/' ) ) { begin_hostport += 2; @@ -1059,6 +1060,12 @@ out->hostport.text.size = 0;
 out->hostport.text.buff = 0;
 begin_path = begin_hostport;
 +
 + //remove excessive leading slashes (fix for Samsung Smart TV 2012)
 + while( ( ( begin_path + 1 ) < max ) && ( in[begin_path] == '/' ) && ( in[begin_path + 1] == '/') ) {
 + begin_path++;
 + }
 +
 }
begin_fragment =
 EOF
cd mediatomb-0.12.1/
 dch -i 'Samsung Smart TV 2012 fix by swiergot'
 dpkg-buildpackage -rfakeroot
 cd ..
 dpkg -i mediatomb-common_0.12.1-4.1_armel.deb mediatomb-daemon_0.12.1-4.1_all.deb mediatomb_0.12.1-4.1_all.deb

mediatomb_console