MythWeb videos cover art thumbnails

So by default MythWeb uses the cover art mythtv downloads, which is fine, however when each cover art image is >1Mb, and you have >100 videos, things get a little silly. What can we do about this? Well quite simply we can make the thumbnails ‘manually’, and then tell MythWeb to use our thumbnails.

All the text like this should be run in the terminal

Step 1: Install ImageMagick, eg (If you are using a debian based distro, eg ubuntu, mythbuntu, mint, etc)

sudo apt-get install imagemagick

Step 2: Use ImageMagick to resize the cover art

You will need to find where your mythtv is storing the cover art. Mine are in /var/lib/mythtv/coverart, so that might be a good place to start.

cd /var/lib/mythtv/coverart/ 

mkdir thumbs 

mogrify -format jpg -path thumbs -thumbnail 94x140 *.jpg

If you want to know more about ImageMagick thumbnails, see http://www.imagemagick.org/Usage/thumbnails/

Step 3: Tell MythWeb to use new thumbnails

Find where the MythWeb files are. Mine are in /var/www/mythweb/
Next go into modules/coverart and open handler.pl in your favourite text editor.
Go down to the line that says “# Find the local file”. Now add /thumbs/ into the lines that start “next unless” and “$filename”. So these couple of lines should now look like

# Find the local file
    our $filename;
    $sh = $dbh->prepare('SELECT dirname FROM storagegroup WHERE groupname = "Coverart"');
    $sh->execute();
    while (my ($coverart_dir) = $sh->fetchrow_array()) {
        next unless (-e "$coverart_dir/thumbs/$cover");
        $filename = "$coverart_dir/thumbs/$cover";
        last;
    }
    $sh->finish;

    1;

Step 4: Done!

Go you your mythweb in your browser, and the thumbnails should be used, making the page load a lot quicker!

The only problem with this however is that you will need to manually create thumbnails for any new videos you add, but this is fairly easy, just run the command to generate the thumbnails again.


Leave a Reply

Your email address will not be published. Required fields are marked *