*mediatomb [#k86c32f0] RIGHT:更新日&lastmod(); DLNA ■前作業 以下、apt-get install XXXXXXXX を実行 ・sqlite3のインストール sqlite3 sqlite3-devel ・mysqlのインストール MySQL-server MySQL-devel MySQL-client MySQL-shared ・zlibのインストール zlib zlib-devel ・taglibのインストール taglib taglib-devel ・id3libのインストール id3lib id3lib-devel ・libexifのインストール libexif libexif-devel # apt-get install expat-devel ・libextractorのインストール ソースの入手(http://core.ring.gr.jp/pub/GNU/libextractor/) コンパイル ./configure make make install /usr/local/lib/libextractor.so.1 のシンボリックリンクを /usr/libへ作成 ■mediatombのコンパイル ・ソースの入手 mediatomb-0.10.0.tar.gz (http://mediatomb.cc/pages/download) ・展開 ・コンパイル LDFLAGS=-L/usr/lib ./configure -with-mysql-cfg=/usr/bin/mysql_config --enable-libextractor make make install ・./configureの結果 CONFIGURATION SUMMARY ---- sqlite3 : yes mysql : yes libjs : missing libmagic : yes inotify : missing libexif : yes id3lib : yes taglib : disabled libextractor : yes ONFIGURATION SUMMARY ----(ISM) sqlite3 : yes mysql : yes libjs : missing libmagic : yes inotify : yes libexif : yes expat : yes id3lib : disabled taglib : yes ffmpeg : disabled external transcoding : yes libextractor : yes ■mediatombの初回起動(ディレクトリ生成) # mediatomb # /usr/local/bin/mediatomb MediaTomb UPnP Server version 0.11.0 - http://mediatomb.cc/ =============================================================================== Copyright 2005-2008 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer. MediaTomb is free software, covered by the GNU General Public License version 2 2009-03-13 18:28:08 INFO: MediaTomb configuration was created in: /root/.mediatomb/config.xml 2009-03-13 18:28:08 INFO: Loading configuration from: /root/.mediatomb/config.xml 2009-03-13 18:28:08 INFO: UUID generated: ebca88e0-c604-4f0f-b026-dbab46136bac 2009-03-13 18:28:08 INFO: Checking configuration... 2009-03-13 18:28:08 INFO: Setting filesystem import charset to EUC-JP 2009-03-13 18:28:08 INFO: Setting metadata import charset to EUC-JP 2009-03-13 18:28:08 INFO: Setting playlist charset to EUC-JP 2009-03-13 18:28:08 INFO: Configuration check succeeded. 2009-03-13 18:28:08 WARNING: Sqlite3 database seems to be corrupt or doesn't exist yet. 2009-03-13 18:28:08 INFO: no sqlite3 backup is available or backup is corrupt. automatically creating database... 2009-03-13 18:28:08 INFO: database created successfully. 2009-03-13 18:28:08 INFO: Initialized port: 49152 2009-03-13 18:28:08 INFO: Server bound to: 10.1.5.188 2009-03-13 18:28:09 INFO: MediaTomb Web UI can be reached by following this link: 2009-03-13 18:28:09 INFO: http://10.1.5.188:49152/ # ^C <=停止 2009-03-13 18:29:25 INFO: MediaTomb shutting down. Please wait... 2009-03-13 18:29:26 INFO: Server terminating ■mediatombの設定 ・/etc/mediatomb.confを作成 「mediatomb.conf」 # cp config/mediatomb-conf-fedora /etc/mediatomb.conf ''sample'' # This is a sambel configuration file for the MediaTomb daemon script ## used on Fedora Core ## By default the configuration will be created in /etc/mediatomb ## Network interface on which the server will run, you need to edit this! ##MT_INTERFACE="NOT_SET" MT_INTERFACE="eth0" ## User defined command line options that may be passed to the server MT_OPTIONS="" ## MediaTomb will be started on port 50500 ##MT_PORT="50500" MT_PORT="50500" ## MediaTomb will run as mediatomb ##MT_USER="mediatomb" ##MT_GROUP="mediatomb" MT_USER="root" MT_GROUP="root" ## Location of the PID file MT_PIDFILE="/var/run/mediatomb.pid" ## Location of the log file MT_LOGFILE="/var/log/mediatomb" ## Location of the config file/database MT_HOME="/etc" MT_CFGDIR="mediatomb" ・/etc/rc.d/init.d/mediatombの作成 「mediatomb」 # cp scripts/mediatomb-service-fedora /etc/rc.d/init.d/mediatomb ''sample'' #!/bin/sh # # mediatomb This script starts and stops the mediatomb daemon # # chkconfig: 2345 95 30 # processname: mediatomb # description: mediatomb is a daemon process which provides a UPnP service # config: /etc/mediatomb # config: /etc/mediatomb/config.xml # pidfile: /var/run/mediatomb.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # Set default mediatomb configuration. # either make an installation in /etc/mediatomb and leave this blank, # or specify an alternative config file location using the -c option # Note: be aware, that -i parameter is used to set the ip of the # interface specified above . /etc/mediatomb.conf ############################### # make sure to run it as nobody MEDIATOMB="-d -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE -l $MT_LOGFILE -m $MT_HOME -f $MT_CFGDIR -p $MT_PORT" [ -f /usr/local/bin/mediatomb ] || exit 0 [ ${MT_INTERFACE} = "NOT_SET" ] && echo "Please edit /etc/mediatomb.conf and change \ the MT_INTERFACE variable to your network device (eth0, eth1, etc.)" && exit 0 PATH=$PATH:/usr/bin:/usr/local/bin # By default it's all good RETVAL=0 # See how we were called. case "$1" in start) # Start daemon. echo -n "Applying multicast settings to $MT_INTERFACE... " # those settings are necessary for us to react to M-SEARCH requests route add -net 239.0.0.0 netmask 255.0.0.0 $MT_INTERFACE >/dev/null 2>&1 ifconfig $MT_INTERFACE allmulti touch $MT_PIDFILE chown mediatomb $MT_PIDFILE mkdir -p "/$MT_HOME/$MT_CFGDIR" chown mediatomb "/$MT_HOME/$MT_CFGDIR" echo -n "Starting mediatomb: " ## daemon $NICELEVEL mediatomb $MEDIATOMB -e $MT_INTERFACE $MT_OPTIONS daemon $NICELEVEL mediatomb $MEDIATOMB RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/mediatomb ;; stop) # Stop daemons. echo -n "Shutting down mediatomb: " killproc mediatomb RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/mediatomb ;; restart) $0 stop $0 start ;; condrestart) [ -e /var/lock/subsys/mediatomb ] && $0 restart ;; status) status mediatomb RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|status|condrestart}" RETVAL=1 ;; esac exit $RETVAL ・mysqlにデータベース作成 # mysql -p Enter password: 空ENTER Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 5.0.27-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE mediatomb; Query OK, 1 row affected (0.06 sec) mysql> GRANT ALL ON mediatomb.* TO 'mediatomb'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye # mysql -p mediatomb < /usr/local/share/mediatomb/mysql.sql Enter password: 空ENTER # ・/etc/mediatomb/config.xmlの作成 「config.xml」 config/mappings.xml => /etc/mediatomb/config.xml <mysql enabled="yes"> ← mysqlを有効化 <host>localhost</host> <username>mediatomb</username> <password>パスワード</password> ← 追加(MySQLのmediatombユーザのパスワードを指定) <database>mediatomb</database> </mysql> ''sapmle'' <?xml version="1.0" encoding="UTF-8"?> <config xmlns="http://mediatomb.cc/config/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/1 http://mediatomb.cc/config/1.xsd" version="1"> <server> <ui enabled="yes"> <accounts enabled="no" session-timeout="30"/> </ui> <name>MediaTomb</name> <udn>uuid:a865d0aa-aa5f-4502-bb8c-6b273f2775f8</udn> <home>/root/.mediatomb</home> <webroot>/usr/local/share/mediatomb/web</webroot> <protocolInfo extend="yes"/> <storage> <mysql enabled="yes"> <host>localhost</host> <username>mediatomb</username> <database>mediatomb</database> </mysql> </storage> </server> <import hidden-files="no"> <filesystem-charset>EUC-JP</filesystem-charset> <metadata-charset>CP932</metadata-charset> <scripting script-charset="UTF-8"> <virtual-layout type="builtin"/> </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="avi" to="video/avi"/> <map from="divx" to="video/divx"/> <map from="m4v" to="video/mp4"/> <map from="mp4" to="video/mp4"/> <map from="gif" to="image/gif"/> <map from="jpeg" to="image/jpeg"/> <map from="png" to="image/png"/> </extension-mimetype> <mimetype-upnpclass> <map from="audio/*" to="object.item.audioItem.musicTrack"/> <map from="application/ogg" to="object.item.audioItem.musicTrack"/> <map from="video/*" to="object.item.videoItem"/> <map from="image/*" to="object.item.imageItem"/> </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="video/x-msvideo" as="avi"/> </mimetype-contenttype> </mappings> </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 -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> ■mediatombの起動 # service mediatomb start Applying multicast settings to eth0... Starting mediatomb: [ OK ] # ■mediatombの自動起動 # chkconfig mediatomb on ■mediatombへの登録 ・Web UIの起動 http://localhost:50500/ ・登録 Filesystemから該当フォルダを選択し"+"アイコンをクリック http://mtada.cocolog-nifty.com/blog/2008/02/vinelinux42medi_7e9d.html http://centossrv.com/mediatomb.shtml