|
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 |
#1
|
|||
|
|||
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: imdb-film lwp-simple file-find cache-cache error 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 Code:
#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!"); `pause`; sub buildthumb() { $curpath = uc($File::Find::name); $curpath =~ s/\//\\/g; $curpath =~ s/\\\\/\\/g; if ($curpath !~ /.*\\VIDEO_TS$/) { return; } #$thumbfile = "\"" . $curpath . "\\folder.jpg" . "\""; $thumbfile = $curpath . "\\folder.jpg"; if (-e $thumbfile) { print("thumb exists \n"); return; } # # 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; `$thumbfile`; } |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|