mediatomb
- download source from http://mediatomb.cc/
- install mysql, and make sure to build with --enable-thread-safe-client
- install spidermonkey, and make sure to copy header file into js/src
- build mediatomb
./configure \ --prefix=/usr/local \ --mandir=/usr/local/man \ --infodir=/usr/local/info \ --enable-mysql \ --with-mysql=/usr/local/mysql \ --enable-libjs \ --with-js-h=/Users/billh/builds/js/src make sudo make install
- setup mysql database to only allow local connections from mediatomb
<login to mysql> create database mediatomb; grant all on mediatomb.* to 'mediatomb'@'localhost';
- start mediatomb (allow it to create ~/.mediatomb/<files>)
- after it sets up files and is running, type ctrl-c to shutdown mediatomb
- edit ~/.mediatomb/config.xml
... <storage> <!-- <sqlite3 enabled="yes"> <database-file>mediatomb.db</database-file> </sqlite3> --> <mysql enabled="yes"> <host>localhost</host> <username>mediatomb</username> <database>mediatomb</database> </mysql> </storage> <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" --> ... <port>49152</port> </server> ... <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="avi" to="video/divx"/> <map from="mpg" to="video/mpeg"/> <map from="mpeg" to="video/mpeg"/> <map from="gif" to="image/gif"/> <map from="jpg" to="image/jpeg"/> <map from="png" to="image/png"/> <map from="mp4" to="video/mp4"/> <map from="mp4a" to="audio/mp4a"/> <map from="m4v" to="video/mp4"/> <map from="3gp" to="video/3gpp"/> <map from="mts" to="video/mpeg"/> <map from="m2ts" to="video/mpeg"/>
- start mediatomb again - db tables will be created in mysql
- add any files you want to share in the web based UI at http://<host>:49152/
Permanent Configuration
After completing the above steps, do the following to have mediatomb run securely on startup:
- shut down mediatomb
- edit config.xml
- disable the UI so everyone won't have access to see every file on your host
<server> <ui enabled="no">
- remove the <home> reference line
<!-- delete or comment out this line entirely --> <home>/your/home/dir/.mediatomb</home>
- move the .mediatomb directory out of your home folder to /usr/local/mediatomb (no dot)
- change the permissions to nobody
sudo chown -R nobody:nobody /usr/local/mediatomb
- create a Mac StartupItem, using the following
#!/bin/sh ## # Configure MediaTomb Server ## . /etc/rc.common StartService () { if [ "${MEDIATOMB:=-NO-}" = "-YES-" ]; then ConsoleMessage "Starting MediaTomb Server" now=`date +%s` let "limit = $now + 60" /usr/local/mysql/bin/mysqladmin -s -u root --password=rootpass status > /dev/null while [ $? -ne 0 ] && [ $now -lt $limit ] do let "now = `date +%s`" if [ $now -ge $limit ]; then ConsoleMessage "MediaTomb could not be started because MySQL was not running after the timeout limit" exit 1 fi /usr/local/mysql/bin/mysqladmin -s -u root --password=rootpass status > /dev/null done sudo -u nobody /usr/local/bin/mediatomb --daemon --home /usr/local --cfgdir mediatomb --logfile /usr/local/var/mediatomb.log fi } StopService () { ConsoleMessage "Stopping MediaTomb Server" sudo killall -15 mediatomb } RestartService () { if [ "${MEDIATOMB:=-NO-}" = "-YES-" ]; then ConsoleMessage "Restarting MediaTomb Server" sudo killall -1 mediatomb else StopService fi } RunService "$1"
Future Development
- Note: may also build with libjs, libmagic, id3lib, taglib