We have a PS3. I got it 'cause it's a great blu-ray player. My son uses it for playing those games. Nevertheless, it will not only play little round discs but movies on a USB stick, or from a "Media Server". The "Media Server" caught my eye - it looked like something that my Solaris NAS box could do.
First shot was to try to set up the server from Windows. It was simple enough, download windows media player and start the services. Of course, it only wanted to play wmv files. That was ok, I just wanted to see what a "media server" was and what it could do. I went a few rounds, learned way more than I wanted about codecs and turned the problem over to my son.
He found Mediatomb on the web and installed it on his Ubuntu box. It worked great even with the mp4s, so we started off on a weekend project to put it on Solaris.
Fortunately, Constantin Schmitz already did this and wrote an excellent blog about how to do it. This makes my blog a whole lot shorter. If you don't want Mediatomb, you can try Twonkymedia, he wrote a blog on setting up that. Follow his blog on Mediatomb on how to install it and I'll make comments from my experiences.
Mediatomb is very configurable. The media organization can be set up through a configuration xml script, javascript and the built in web service. The webpage gives you a view of what the PS3 sees and a file tree to add directories and media files. The organization from the files on the server and what is seen by the PS3 is managed through javascript.
Tweaks in the installation
Blastwave instructions don't use pkg-get -i anymore. The instructions now use pkgutil --install. pkg-get is still around but the default wasn't pointing to anything useful and pkgutil worked fine.
You have to grab a copy of libmagic and will have to poke around ftp.astron.com with ftp to find the latest release. I ended up with 5.0 and that will likely change again. I couldn't get it to compile correctly with cc, I changed to gcc and it worked fine. Compile taglib as per instructions and then grab a copy of Mediatomb. I used gcc for that too.
I used SMF for starting up and shutting down mediatomb. I'll describe the setup at the end. You do need a start up script. I put the configuration for it in /etc/mediatomb.
mkdir /etc/mediatomb
Cut the following and put into a file /etc/mediatomb/mediatomb.conf
Customize for your own preferences.
--------------------
# install in /etc/mediatomb
MT_INTERFACE="e1000g0"
## MediaTomb port must be private >= 49152
MT_PORT="49194"
# Username and group
MT_USER="bob"
MT_GROUP="family"
# PID file path
MT_PIDFILE="/var/run/mediatomb/mediatomb.pid"
# Log file path
MT_LOGFILE="/var/log/mediatomb/mediatomb.log"
# Config file path
MT_HOME="/export/home/bob"
-------------------
You want to create a mediatomb directory in /var/run and in /var/log
cd /var/run (and /var/log)
mkdir mediatomb
chown user:group mediatomb
chmod 755 mediatomb
Create a startup script in /lib/svc/method/ called svc-mediatomb
-------------------------
#!/sbin/sh
. /etc/mediatomb/mediatomb.conf
LD_LIBRARY_PATH=/opt/csw/lib:/opt/local/lib:/usr/lib/firefox /opt/local/bin/mediatomb \
--interface $MT_INTERFACE \
--port $MT_PORT --daemon \
--pidfile $MT_PIDFILE \
--logfile $MT_LOGFILE \
--home $MT_HOME
A few notes. LD_LIBRARY_PATH is not the best way to go. I don't like LD_PRELOAD either and it was not clear to me from the error message of how to get that to work. The LD_LIBRARY_PATH does work and I'm using it for now. I hope a cleaner method eventually comes to past. I do believe the use of ZFS/Solaris and a mediaserver is a big win.
First time Mediatomb is run, it creates a directory in $HOME/.mediatomb. Inside .mediatomb are the database files and default configuration file config.xml. This is the basic configuration file and it is read when the service is restarted.
You will need to edit the config.xml file:
Set a login for those that want to set up Mediatomb.
<accounts enabled="yes" session-timeout="30">
<account user="bob" password="a password"/>
</accounts>
The name tag is what shows up on the PC and on the PS3 as the media server name. Good idea to make it something identifiable.
<name>Bob's Solaris Media Server</name>
I set it up to view the media files with javascript and didn't need the directory view for the PS3.
<pc-directory upnp-hide="yes"/>
We are going to change the javascript files from the default. This requires the following lines changed:
<common-script>/opt/local/share/mediatomb/js/common.js</common-script>
<playlist-script>/opt/local/share/mediatomb/js/playlists.js</playlist-script>
<virtual-layout type="js">
<import-script>/opt/local/share/mediatomb/js/import.js</import-script>
</virtual-layout>
The virtual-layout tag must be changed from builtin to js for it to read the javascript that you modified.
Add Constantin's changes to the config.xml file for <filesystem-charset>, <magic-file>, <protocolInfo extend="yes"/> and map to tags as he suggested.
Adding some categories for Video
Mediatomb uses javascript to map the media files over to the upnp container structure that the PS3 uses. It's very smart about this for pictures and audio files as the metadata is quite rich. This is not the case for video default is to dump all videos into a 'Video' container.
I didn't like this but didn't want anything very complicated. I needed basic categories and the movie title. I set it up that each user had a 'media' directory that would contain movies, pictures, and audio. Inside of this directory would be subdirectories to categorize the movies. The filename of the video will be used as the title of the move but with the file extension removed.
This is done by changing the javascript file, import.js.
In import.js, replace the text:
// currently no video metadata supported
function addVideo(obj)
{
var chain = new Array('Video');
addCdsObject(obj, createContainerChain(chain));
}
with
function addVideo(obj)
{
var loc = obj.location.split('/');
var mediaFound = false;
var chain = new Array("Video");
for(i=0; i<loc.length-1;i++) {
if(mediaFound) chain.push(loc[i]);
if(loc[i].toLowerCase() == "media") mediaFound = true;
}
str = loc[loc.length-1];
obj.title = str.substring(0,str.lastIndexOf('.'));
addCdsObject(obj, createContainerChain(chain));
}
Save these files and restart the server.
Setting up the media
You will need to create a media directory in your user space. Within this directory create subdirectories for categories like movies, tv shows, etc. and possibly further subdirectories for series, episodes. Do not get carried away with the hierarchy as there is a limit of subdirectories on the PS3. The audio and pictures can go into the media directory without subdirectories.
If you have upnp on in Windows, it should show up as a networked monitor with rabbit ears in Network Places. Clicking on this should open up your webbrowser to Mediatomb file/database configuration page. If you enabled login, it will then have a login screen for user/password. It will then show two tabs, filesystem and database.
Click on filesystem tab and browse the file tree until you find your media directory. Click on the + icon with the little round arrows (Tooltips would be nice here). This will bring up a form to set up autoscan of this directory. Set the scan level and make sure recursive folders is checked to pick up the subdirectories.
Any files added to the media directory will be automatically added to the upnp container from then on.
Clicking on the Database tab will show the organization of how it will look on the PS3. The only difference is while the PC Directory always shows in the browser, it can be selectively hidden for the PS3.
Setting up a service
This is my first shot at setting up a service. Copy the following xml between the dotted lines and
write as /var/svc/manifest/application/mediatomb.xml
-------------------
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="mediatomb">
<service name="application/mediatomb" type="service" version="1">
<create_default_instance enabled="false"/>
<single_instance/>
<dependency
name="network"
grouping="require_all"
restart_on="error"
type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency
name="filesystem"
grouping="require_all"
restart_on="error"
type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<exec_method
type="method"
name="start"
exec="/lib/svc/method/svc-mediatomb"
timeout_seconds="60">
<method_context>
<method_credential user="bob" group="family"/>
</method_context>
</exec_method>
<exec_method
type="method"
name="stop"
exec=":kill"
timeout_seconds="60">
</exec_method>
<property_group name="startd" type="framework">
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">
UPnP Media Server
</loctext>
</common_name>
<documentation>
<manpage
title='mediatomb'
section='1'
manpath='/opt/local/share/man' />
<doc_link name='mediatomb.cc'
uri='http://mediatomb.cc' />
</documentation>
</template>
</service>
</service_bundle>
-------------------
The /etc/mediatomb/, /var/run/mediatomb,/var/log/mediatomb, mediatomb.conf and config.xml home tag all should have a username/groupname and appropriate protection fields set. Once everything is set, check the manifest to make sure it's ok with:
svccfg validate /var/svc/manifest/application/mediatomb.xml
if ok, then import
svccfg import /var/svc/manifest/application/mediatomb.xml
and check status
svcs mediatomb
It should be disabled.
Start mediatomb with
svcadm enable mediatomb
stop it with
svcadm disable mediatomb
if it isn't running check status with
svcs -xv
Problems show up as "maintenance" mode
You can check both the smf log files in the svcs error message and the log file from mediatomb to find what is going wrong.
Once the problem is fixed, clear smf with
svcadm clear mediatomb
svcadm disable mediatomb
and try again, svcadm enable mediatomb


























If you're into robotics (and why wouldn't you be, right?), and especially if you're in the younger crowd, you'll likely be as excited as we are about 





















We
hired contractor, Del Peck, our trumpet playing, PC layout artist and
design engineer to work with me on this project. We came up with the
bSPOT based on the AT91FR40162. A company based out of Great Britain,
called Syntropy, did most of the port of Squawk to this new SPOT.
We
borrowed John Harada to do the real mechanical design. We also put a
shield around the radio to get FCC modular approval. This gave us
flexibility to change the digital stuff without having to retest the
compliance of the transmitter. We worked with the compliance group to
insure it was safe and wasn't going to interfere.












