SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations


SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Thread Tools Search this Thread Display Modes
Old 01-10-2007, 11:41 PM
sundansx sundansx is offline
Sage Advanced User
Join Date: Aug 2003
Posts: 193
Perl script to automatically grab movie thumbs

Here is a perl script that I wrote that recursively scans the path you give it to search for dvds and looks the title up by name on imdb. it then downloads the jpg file for it from imdb and names it 'folder.jpg' and places it in the correct folder, it then shows the jpg to you using your default jpg viewer (close the viewer after each download to go on). The thumbnail is then shown in the sage interface.

It is dependent on the name of the folder you have a dvd in, so its accuracy is based on that. I had some problems with it on the latest version of dvd fab, as it seems to put dvds is some sort of overzealous file structure, but supports dvd_name\dvd\video_ts and dvd_name\video_ts structure. It probably needs some tweaking to make it more robust on that end.

1. install activeperl
2. you have to load a few perl packages via the perl package manager:
3. run it and pass it the name of the folder where you keep your dvds

here is the script, paste it into a file named whatever you want

#IMDB-film (needs "error" and "cache-cache" libs)
use IMDB::Film;
use LWP::Simple;
use File::Find;

$path = $ARGV[0];

#cool recursive file find, first is a function pointer, sec is start path
find(\&buildthumb, $path);
print("press any key to exit!");

sub buildthumb() {
  $curpath = uc($File::Find::name);
  $curpath =~ s/\//\\/g;
  $curpath =~ s/\\\\/\\/g;
  if ($curpath !~ /.*\\VIDEO_TS$/)  {
  #$thumbfile = "\"" . $curpath . "\\folder.jpg" . "\"";
  $thumbfile = $curpath . "\\folder.jpg";
  if (-e $thumbfile) {
    print("thumb exists \n");

  # Retrieve a movie information by its title
  $curpath =~ m/.*\\(.*)\\VIDEO_TS$/;
  $title = $1;
  if ($title eq "DVD") {
    $curpath =~ m/.*\\(.*)\\DVD\\VIDEO_TS$/;
    $title = $1;
  $title =~ s/_/ /g;
  my $imdbObj = new IMDB::Film(crit => $title);

  # Parse already stored HTML page from IMDB
  #my $imdbObj = new IMDB::Film(crit => 'troy.html');

  if($imdbObj->status) {
          print "Path: ".$curpath."\n";
          print "Title: ".$imdbObj->title()."\n";
          print "Year: ".$imdbObj->year()."\n";
#          print "Plot Symmary: ".$imdbObj->plot()."\n";
          print "Cover URL: ".$imdbObj->cover()."\n";
  } else {
          print "Something wrong: ".$imdbObj->error;

  $url = $imdbObj->cover();
  $content = getstore($url, $thumbfile);
    die "Couldn't get it!" unless defined $content;
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 05:08 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.