Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Need help with setting up mediatomb again

Got problems with your B2 or B3? Share and get helped!
Post Reply
nick85
Posts: 10
Joined: 25 Jul 2011, 10:46

Need help with setting up mediatomb again

Post by nick85 »

Hi,
I have deleted mediatomb from the system, and then rebuilt it from source again, and it is now fully functioning with srt support for Samsung TVs etc...

Now I wish to have it started on system boot, as a service and to be able to control it through the web admin interface (by the enable/disable upnp service). And I assume it should also be runned by user account "mediatomb".


Can anyone help me to get this set up?


Thanks in advance!
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Need help with setting up mediatomb again

Post by Ubi »

Here's my script from /etc/init.d/mediatomb
Enable on startup via

Code: Select all

chkconfig mediatomb on
The content of the file:

Code: Select all

#! /bin/sh
#
# MediaTomb initscript
#
# Original Author: Tor Krill <tor@excito.com>.
# Modified by:     Leonhard Wimmer <leo@mediatomb.cc>
# Modified again by Andres Mejia <mcitadel@gmail.com> to
# base it off of /etc/init.d/skeleton
#
#

### BEGIN INIT INFO
# Provides:          mediatomb
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: upnp media server
### END INIT INFO

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="upnp media server"
NAME=mediatomb
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
SCRIPTNAME=/etc/init.d/$NAME
DEFAULT=/etc/default/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r $DEFAULT ] && . $DEFAULT

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Start the daemon if NO_START is disabled in DEFAULT
if [ "$NO_START" = "yes" ] && [ "$1" != "stop" ]; then
	log_warning_msg "$NAME: Not starting $DESC."
	log_warning_msg "$NAME: Disabled in $DEFAULT."
	exit 0
fi

# Run as root if USER not specified
if [ ! $USER ]; then
	USER=root
fi

# Check for an invalid user or one without a home directory
eval USERHOME=~$USER
if [ "${USERHOME#/}" = "${USERHOME}" ]; then
	log_failure_msg "$NAME: The user '$USER' specified in $DEFAULT is invalid."
	exit 1
fi

# Check if group is not specified and assign a proper group
if [ -z $GROUP ]; then
    GROUP="$USER"
fi

if [ "$INTERFACE" != "" ] ; then
    INTERFACE_ARG="-e $INTERFACE"
else
    INTERFACE_ARG=""
fi

DAEMON_ARGS="-c /etc/mediatomb/config.xml -d -u $USER -g $GROUP -P $PIDFILE -l $LOGFILE $INTERFACE_ARG $OPTIONS"

#
#       Function that starts the daemon/service.
#
do_start() {
	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   2 if daemon could not be started
	touch $PIDFILE
	chown $USER:$GROUP $PIDFILE
	touch $LOGFILE
	chown $USER:$GROUP $LOGFILE
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
		--test > /dev/null \
		|| return 1
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
		$DAEMON_ARGS \
		|| return 2
}

#
#       Function that stops the daemon/service.
#
do_stop() {
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2
	rm -f $PIDFILE
	return "$RETVAL"
}

#
#       Function that sends a SIGHUP to the daemon/service.
#
do_reload() {
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
	return 0
}

case "$1" in
  start)
	if [ -n "$INTERFACE" ]; then
		# try to add the multicast route
		if [ "$VERBOSE" != no ]; then
			{
				log_action_begin_msg \
				"$NAME: Trying to add the multicast route"
				$ROUTE_ADD $INTERFACE \
				&& log_action_end_msg 0
			} || {
				true && \
				log_warning_msg "Failed to add multicast route. skipping."
			}
		else
			$ROUTE_ADD $INTERFACE >/dev/null 2>&1 || true
		fi
	fi
	log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case "$?" in
		0) log_end_msg 0 ;;
		1) log_warning_msg "$DESC" "'$NAME'" "was already started" ;;
		2) log_end_msg 1 ;;
	esac
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case "$?" in
		0)
			log_end_msg 0
			if [ -n "$INTERFACE" ]; then
				# try to add the multicast route
				if [ "$VERBOSE" != no ]; then
				{
					log_action_begin_msg \
					"$NAME: Trying to delete the multicast route"
					$ROUTE_DEL $INTERFACE \
					&& log_action_end_msg 0
				} || {
					true && \
					log_warning_msg \
					"Failed to delete multicast route. skipping."
				}
				else
					$ROUTE_DEL $INTERFACE >/dev/null 2>&1 || true
				fi
			fi
			;;
		1) log_warning_msg "$DESC" "'$NAME'" "was already stopped" ;;
		2) log_end_msg 1 ;;
	esac
	;;
  reload|force-reload)
	log_daemon_msg "Reloading $DESC" "$NAME"
	do_reload
	log_end_msg $?
  	;;
  restart)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
	log_daemon_msg "Restarting $DESC" "$NAME"
	do_stop
	case "$?" in
	  0|1)
		sleep 1
		do_start
		case "$?" in
			0) log_end_msg 0 ;;
			1) log_end_msg 1 ;; # Old process is still running
			*) log_end_msg 1 ;; # Failed to start
		esac
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac

:
Here's my /etc/mediatomb/config.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://mediatomb.cc/config/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1" xsi:schemaLocation="http://mediatomb.cc/config/1 http://mediatomb.cc/config/1.xsd">
  <!--
     Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
     information on creating and using config.xml configration files.
    -->
  <server>
	<interface>br0</interface>  
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="mediatomb" password="mediatomb"/>
      </accounts>
    </ui>
    <name>b3</name>
	<manufacturerURL>http://www.excito.com/</manufacturerURL>
	<modelname>BUBBA|3</modelname>
	<modelnumber>1.0.0</modelnumber>
    <udn>uuid:43a5bd6c-9e9b-4dfb-86a5-6f180ffdf44b</udn>
    <home>/var/lib/mediatomb</home>
	<webroot>/usr/share/mediatomb/web</webroot>
	<storage>
      <mysql enabled="yes">
		<host>localhost</host>
        <username>mediatomb</username>
        <database>mediatomb</database>
		<password>rDI5IDNOSnoQ</password>	
      </mysql>
    </storage>
    <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
    <!--
       Uncomment the lines below to get rid of jerky avi playback on the
       DSM320 or to enable subtitles support on the DSM units
    -->
    <!--
    <custom-http-headers>
      <add header="X-User-Agent: redsonic"/>
    </custom-http-headers>

    <manufacturerURL>redsonic.com</manufacturerURL>
    <modelNumber>105</modelNumber>
    -->
    <!-- Uncomment the line below if you have a Telegent TG100 -->
    <!--
       <upnp-string-limit>101</upnp-string-limit>
    -->
    <extended-runtime-options>
      <ffmpegthumbnailer enabled="no">
        <thumbnail-size>128</thumbnail-size>
        <seek-percentage>5</seek-percentage>
        <filmstrip-overlay>yes</filmstrip-overlay>
        <workaround-bugs>no</workaround-bugs>
      </ffmpegthumbnailer>
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
      </mark-played-items>
    </extended-runtime-options>
  </server>
  <import hidden-files="no">
    <scripting script-charset="UTF-8">
      <common-script>/usr/share/mediatomb/js/common.js</common-script>
      <playlist-script>/usr/share/mediatomb/js/playlists.js</playlist-script>
      <virtual-layout type="builtin">
        <import-script>/usr/share/mediatomb/js/import.js</import-script>
        <dvd-script>/usr/share/mediatomb/js/import-dvd.js</dvd-script>
      </virtual-layout>
    </scripting>
    <mappings>
      <extension-mimetype ignore-unknown="no">
        <map from="mp3" to="audio/mpeg"/>
        <map from="ogg" to="application/ogg"/>
        <map from="asf" to="video/x-ms-asf"/>
        <map from="asx" to="video/x-ms-asf"/>
        <map from="wma" to="audio/x-ms-wma"/>
        <map from="wax" to="audio/x-ms-wax"/>
        <map from="wmv" to="video/x-ms-wmv"/>
        <map from="wvx" to="video/x-ms-wvx"/>
        <map from="wm" to="video/x-ms-wm"/>
        <map from="wmx" to="video/x-ms-wmx"/>
        <map from="m3u" to="audio/x-mpegurl"/>
        <map from="pls" to="audio/x-scpls"/>
        <map from="flv" to="video/x-flv"/>
        <map from="mkv" to="video/x-matroska"/>
        <map from="mka" to="audio/x-matroska"/>
        <!-- Uncomment the line below for PS3 divx support -->
        <!-- <map from="avi" to="video/divx"/> -->
        <!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
        <!-- <map from="avi" to="video/avi"/> -->
      </extension-mimetype>
      <mimetype-upnpclass>
        <map from="audio/*" to="object.item.audioItem.musicTrack"/>
        <map from="video/*" to="object.item.videoItem"/>
        <map from="image/*" to="object.item.imageItem"/>
        <map from="application/ogg" to="object.item.audioItem.musicTrack"/>
      </mimetype-upnpclass>
      <mimetype-contenttype>
        <treat mimetype="audio/mpeg" as="mp3"/>
        <treat mimetype="application/ogg" as="ogg"/>
        <treat mimetype="audio/x-flac" as="flac"/>
        <treat mimetype="image/jpeg" as="jpg"/>
        <treat mimetype="audio/x-mpegurl" as="playlist"/>
        <treat mimetype="audio/x-scpls" as="playlist"/>
        <treat mimetype="audio/x-wav" as="pcm"/>
        <treat mimetype="audio/L16" as="pcm"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="video/mp4" as="mp4"/>
        <treat mimetype="audio/mp4" as="mp4"/>
        <treat mimetype="application/x-iso9660" as="dvd"/>
        <treat mimetype="application/x-iso9660-image" as="dvd"/>
        <treat mimetype="video/x-matroska" as="mkv"/>
        <treat mimetype="audio/x-matroska" as="mka"/>
      </mimetype-contenttype>
    </mappings>
    <online-content>
      <!-- Make sure to setup a transcoding profile for flv -->
      <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="flv" hd="no">
        <favorites user="mediatomb"/>
        <standardfeed feed="most_viewed" time-range="today"/>
        <playlists user="mediatomb"/>
        <uploads user="mediatomb"/>
        <standardfeed feed="recently_featured" time-range="today"/>
      </YouTube>
      <Weborama enabled="no" refresh="28800" update-at-start="no">
        <playlist name="Active" type="playlist" mood="active"/>
        <playlist name="Metal" type="playlist">
          <filter>
            <genres>metal</genres>
          </filter>
        </playlist>
      </Weborama>
      <AppleTrailers enabled="no" refresh="43200" update-at-start="no" resolution="640"/>
    </online-content>
	<autoscan>
		<directory location="/home/storage/video" mode="inotify" recursive="yes" hidden-files="no"/>
		<directory location="/home/storage/music" mode="inotify" recursive="yes" hidden-files="no"/>
		<directory location="/home/storage/pictures" mode="inotify" recursive="yes" hidden-files="no"/>
	</autoscan>	
  </import>
  <transcoding enabled="no">
    <mimetype-profile-mappings>
      <transcode mimetype="video/x-flv" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="oggflac2raw"/>
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
    </mimetype-profile-mappings>
    <profiles>
      <profile name="oggflac2raw" enabled="no" type="external">
        <mimetype>audio/L16</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
      </profile>
      <profile name="vlcmpeg" enabled="no" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>yes</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/>
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
      </profile>
    </profiles>
  </transcoding>
</config>
nick85
Posts: 10
Joined: 25 Jul 2011, 10:46

Re: Need help with setting up mediatomb again

Post by nick85 »

Thanks... I have now solved it.
It was also necessary to enable UPnP streaming in the B3 web admin interface.

What exactly is happening on the system when I enable/disable "UPNP streaming" under Administration / Services in the B3 web admin interface?
Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Re: Need help with setting up mediatomb again

Post by Eek »

It stops or starts mediatomb
cheers
Eek
nick85
Posts: 10
Joined: 25 Jul 2011, 10:46

Re: Need help with setting up mediatomb again

Post by nick85 »

Yes, but which command is thrown? It cannot simply be /etc/init.d/mediatomb start/stop
Something else must happend. Because when I have it disabled, mediatomb will not autostart on boot. But when it is enabled it will. So it must change some config file somewhere?
carl
Posts: 474
Joined: 07 May 2008, 04:41

Re: Need help with setting up mediatomb again

Post by carl »

nick85 wrote:Yes, but which command is thrown? It cannot simply be /etc/init.d/mediatomb start/stop
Something else must happend. Because when I have it disabled, mediatomb will not autostart on boot. But when it is enabled it will. So it must change some config file somewhere?
It shuts it down/starts it up, and adds/removes symlinks to the init script from/into /etc/rcN.d;

Notice by the way that the upgrade today will replace mediatomb with minidlna.
/Carl Fürstenberg, Excito Software Developer
http://www.excito.com
support@excito.com
nick85
Posts: 10
Joined: 25 Jul 2011, 10:46

Re: Need help with setting up mediatomb again

Post by nick85 »

Why are you replacing mediatomb with minidlna? Any specific reason? So if I update my B3 box using the web interface you will remove mediatomb for me? How can I prevent that from happening? I want to continue running Mediatomb - for me it is THE DLNA server.
carl
Posts: 474
Joined: 07 May 2008, 04:41

Re: Need help with setting up mediatomb again

Post by carl »

nick85 wrote:Why are you replacing mediatomb with minidlna? Any specific reason? So if I update my B3 box using the web interface you will remove mediatomb for me? How can I prevent that from happening? I want to continue running Mediatomb - for me it is THE DLNA server.
The main reason for switching to MiniDLNA is that it works on both PS3 and Xbox360, which mediatomb doesn't. Mediatomb won't get uninstalled, only deactivated, you can manually reactivate mediatomb if you want.
/Carl Fürstenberg, Excito Software Developer
http://www.excito.com
support@excito.com
johannes
Posts: 1470
Joined: 31 Dec 2006, 07:12
Location: Sweden
Contact:

Re: Need help with setting up mediatomb again

Post by johannes »

And to note: Mediatomb is not a DLNA server, it's UPnP. It lacks support for many modern devices.
/Johannes (Excito co-founder a long time ago, but now I'm just Johannes)
nick85
Posts: 10
Joined: 25 Jul 2011, 10:46

Re: Need help with setting up mediatomb again

Post by nick85 »

Thanks for the replies.
Post Reply