Sunday, December 7, 2014

Get information about movies using perl IMDB::Film module


I got a 3 TB hard disk with a bunch of movies and I wanted to keep all the movies where the IMDB rating is greater than 7 removing all the others. Since there were hundreds of movies, I thought of automating the task.

When I Googled to find out an easier method, I found an article (http://davide.eynard.it/2011/01/20/perl-hacks-automatically-get-info-about-a-movie-from-imdb/) that describes how useful the IMDB::Film (http://search.cpan.org/~stepanov/IMDB-Film-0.53/lib/IMDB/Film.pm) perl module is for my task.

So I wrote a simple Perl script which reads movie title (in <movie name><year><other information> format) from STDIN and prints selected information about the movie to STDOUT.

e.g.:
root@LS-VL406:~/IMDB_Reader# echo 'Star Trek Into Darkness 2013 BRRip XviD AC3-SANTi' | ./GetMovieInfo.pl                     
Star Trek Into Darkness 2013 BRRip XviD AC3-SANTi,Star Trek Into Darkness,2013,movie,7.9,When the crew of the Enterprise is called back home, they find an unstoppable force of terror from within their own organization has detonated the fleet and everything it stands for, leaving our world in a state of crisis. With a personal score to settle, Captain Kirk leads a manhunt to a war-zone world to capture a one-man weapon of mass destruction. As our heroes are propelled into an epic chess game of life and death, love will be challenged, friendships will be torn apart, and sacrifices must be made for the only family Kirk has left: his crew.


This is a very simple Perl script so anyone can modify the script to add whatever information is required for a movie. Also it reads input from STDIN and prints output to STDOUT so that the unix pipe can be used for various pre and post processing such as read a movie list from a file and pipe it to the script.

I have tested this on a system which runs Fedora 20 on it and also on Buffalo linkstation NAS.

The script can be downloaded from here, All the required perl modules are included so that the user does not need to install any additional Perl modules.

https://sites.google.com/site/blogswapoff/IMDB_Reader.tar.gz


No comments:

Post a Comment