The Cube - Assimilating Technology

The Cube

MediaTomb Movie Posters

For Humans only


Print E-mail

I Recently got one of the new PlayStation 3 80gig models for my birthday.

The PlayStation 3 can be used as a media center, and this task can be accomplished in two ways:

1. Install another OS, and use a media center system for said OS. I would use linux, and MythTV.
2. Install a uPnP server on your network, and serve the media to the PS3. The PS3 will detect the uPnP server, and you can access the files that way.

I decided to go with the second method, as I did not want to install Linux onto it at this point, and I also already have a mythTV box running.

The first task was to decide on the uPnP server, and for this I chose MediaTomb.

MediaTomb is extremely configurable, and one of the most powerful features is the fact that you can adjust the import script, thus you can have the media imported in any structure you like.
Another feature is that it can transcode media on-the-fly by making use of external applications, and you can select which media types to transcode using a variety of methods (media type, file extention etc)
I also liked the fact that you can serve thumbnails to the PS3 for the media.

Googling, I found instructions on how to push thumbnails to the PS3, by making use of ffmpegthumbnailer.
This was great, but I would prefer the actual movie posters, like it is done in mythTV.

This document describes how I created the ability for MediaTomb to serve out the actual movie posters, making use of some external programs.

The first thing you need to do is to install imagemagick.
As I am using debian linux, I will describe how that is done. If you are using another flavour of linux, you will have to install the required packages using your distro's package manager.

$ sudo aptitude install imagemagick

The next step is to download the IMDB website scraper perl script, which is part of the mythTV support scripts. I have placed the latest script which I use on my website, thus saving you from fetching it from the mythtv svn server.
Click to download imdb.pl

Save the file in a convenient place on your box. In my examples below, I am using the already installed script from the mythTV directories ('/usr/share/mythtv/mythvideo/scripts/imdb.pl'). You can adjust where it is accessed from in the next part below.

Remember to make it executable.The command below is run from within the same folder where you saved the script.

$ chmod +x ./imdb.pl 

Next you need my custom script which fetches the movie posters from the imdb website.
(file updated on 2009-07-31. Path variable to imdb.pl  more robust. Thanks to Michael Müller for testing)
(file updated on 2009-09-09. Trey Waters added functionality to ask for IMDB number if not found)
(file updated on 2010-01-10.  Chad Halvorson required recursive folder parsing for files. Additionally added some filename cleanups.

 

Click to download mt_imdb.pl

 

Save the script in a convenient place on your system. Mine is located in the mythtv user (simply called 'user' on my box) home directory. You will use this script either in a cron job, or manually to fetch the posters.
Remember to make it executable. The command below is run from within the same folder where you saved the script.

$ chmod +x ./mt_imdb.pl 

Before you use this script, you need to set some configuration options inside the script. This is done by simply editing the script. Use your favourite editor for this task. I like joe.

$ joe ./mt_imdb.pl

At line number 20 you will find:

# SET YOUR VARIABLES HERE !!
my $basepath='/media/SUMODISK/movies/'; 
my $imdb= '/usr/share/mythtv/mythvideo/scripts/imdb.pl'; 
my $posters='/media/SUMODISK/movies/posters'; 
my $upscale='1';
my $convertcommand='/usr/bin/convert';
my $forcedefault="1";

Here you must change the values:

$basepath - This is the full path to where your media is stored.
$imdb - This is the path to where you saved the imdb.pl script you downloaded in the step above.
$posters - This is the path and folder to which the script will save the posters it grabbed from the site.
$upscale - Set to 1 if you want to increase the image files by 50%, or to keep the original size set to 0 (Note, this option is experimental, and can make the posters stop working, start with it set to 0, and once it is all working, set to 1 to try and upscale)
$convertcommand - the path to the 'convert' program which is part of imagemagick install.
$forcedefault - set this to 1 and the script will automatically select the default entry from the IMDB

Now save your script.

This script is not used directly by mediatomb, and is run externally to keep your posters up to date. You can either run it manually, or add a cron job to run it on a schedule.
If you run it manually, you just issue the command:

$ ./mt_imdb.pl

The next step is to get the mediatomb support script, which will display (or push) the posters to the PS3.

To note here is that the script will use ffmpegthumbnailer as a fallback, if the movie does not have a poster available.
The script will also create a ffmpegthumbnailer cache, so the thumbnail does not have to be generated every time.

You must thus install ffmpegthumbnailer for this to work.The command used below is once again Debian based.
Use your own distro's package manager to install the package.

$ sudo aptitude install ffmpegthumbnailer 

Click to download mt_poster.sh

Save the file again on your local system. Mine is in the same folder as the mt_imdb.pl script.
Remember to make it executable. T
he command below is run from within the same folder where you saved the script.

$ chmod +x ./mt_poster.sh 

You must again setup the script's settings by using your editor.

$ joe mt_poster.sh

On line  6, you will find:

# EDIT THE LINE BELOW AND PLACE YOUR POSTER PATH
POSTERPATH="/media/movies/posters"

The POSTERPATH value must be the same as the value you supplied to mt_imdb.pl's  $posters variable in the script mt_imdb.pl above.

Save the script.

The last step is to adjust mediatomb's configuration script.
In Debian this is located in /etc/mediatomb/config.xml

joe /etc/mediatomb/config.xml

In the file find the section '<transcoding enabled="no">' and change it to '<transcoding enabled="yes">'
Just below that you will find the lines: (yours may differ slightly, if your config file is not standard), but it will be in a section called '<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"/>  

and add the following line below  the last one, and before the section end line (' </mimetype-profile-mappings>')

        <transcode mimetype="video/divx" using="video-thumbnail"/>  

The line above defines that a decoding profile called 'video-thumbnail' will be called for divx videos.

You now need to define the profile itself.
Find the section called '<profiles>' (should be the next section in the config file), and find the line where the profile section ends with ' </profiles>'
Place the following block of code just above the section end tag:

   <profile name="video-thumbnail" enabled="yes" type="external">
            <mimetype>image/jpeg</mimetype>
            <accept-url>yes</accept-url>  
            <thumbnail>yes</thumbnail>    
            <resolution>128x128</resolution>
            <agent command="/home/user/mt_poster.sh" arguments="%in %out"/>
            <buffer size="524288" chunk-size="512" fill-size="1024"/>
   </profile>

You must change the path to the mt_poster.sh file in the <agent command> section above, and point it to where you saved yourmt_poster.sh file.

My config.xml is available for download, which can help if you run into any problems with the configuration.

That should be it.

Restart MediaTomb, and browse to your video files on your PS3.
If there is a poster found from IMDB then it will display, else a movie thumbnail will be shown.

On my system, MediaTomb runs on a very low end via-epia mini-itx board.

Sometimes, on initial thumbnail load, (ffmpegthumbnailer) no image appears, but if I go out, and back into the folder, they appear fine.
I suspect it is an issue with the PS# timeout waiting for a poster, and the little mini-itx board just being a bit slow generating them, but once the cached image is available, it works fine.

Trouble shooting:

Some things to try if it is not working:


After you ran the mt_imdb.pl file to collect the posters, did double check if the posters were indeed downloaded to the designated folder.
Can you open one of the image files?

If you cannot open one of the files to view as an image, disable the upscale method in mt_imbd.pl, and run it again.
See after that if the images can be viewed.

Have a look at the mediatomb log file located in /var/logmediatomb.log

If the thumbnail script is called, you'll see stuff like:

2009-08-07 09:00:29    INFO: Arguments: %in %out
2009-08-07 09:00:30    INFO: Arguments: %in %out

which means it is calling the external script.

Read the log file, look for any obvious error messages.

 

 

 
Share on facebook