NAME ==== TMDB - Perl wrapper for The MovieDB API SYNOPSIS ======== use TMDB; # Initialize my $tmdb = TMDB->new( { api_key => 'xxxxxx' } ); # Search for movies my @results = $tmdb->search->movie('Italian Job'); foreach my $result (@results) { print "#$result->{id}: $result->{name} ($result->{year})\n"; } # Get movie info my $movie = $tmdb->movie('19995'); printf( "%s (%s)\n", $movie->name, $movie->year ); printf( "%s\n", $movie->tagline ); printf( "Overview: %s\n", $movie->overview ); printf( "Director: %s\n", join( ',', $movie->director ) ); printf( "Cast: %s\n", join( ',', $movie->cast ) ); DESCRIPTION =========== The MovieDB is a free and open movie database. This module provides a Perl wrapper to The MovieDB API. In order to use this module, you must first get an API key by signing up. METHODS ======= new(%options) ------------- my $tmdb = TMDB->new({api_key => 'xxxxxxx', ua => $ua}); The constructor accepts the following options - api_key Requierd. This is your TMDb API key - ua Optional. You can initialize with your own LWP::UserAgent SEARCH ------ The following search methods are available - movie($name) - movie({name => $name, year => $year}) my @results = $tmdb->search->movie('Avatar'); # Using a title my @results = $tmdb->search->movie('Avatar (2009)'); # Title includes year my @results = $tmdb->search->movie( { name => 'Avatar', year => '2009' } ); # Split them up The search result returned is an array, or undef if nothing is found. Each element in the result array is a hash ref containing name (movie name), year (release year), id (TMDb ID), thumb (A thumbnail image URL) and url (TMDb movie URL). - person($name) my @results = $tmdb->search->person('George Clooney'); The search result returned is an array, or undef if nothing is found. Each element in the result array is a hash ref containing name (Person's name), id (TMDb ID), thumb (A thumbnail image URL) and url (TMDb profile URL). - imdb($imdb_id) my @results = $tmdb->search->imdb('tt1542344'); This allows you to search a movie by its IMDB ID. The search result returned is the same as ["movie(name)"](#movie(name)) - dvdid($dvdid) my @results = tmdb->search->dvdid(dvdid); This allows you to search a movie by its DVDID. The search result returned is the same as ["movie(name)"](#movie(name)) - file($filename) my @results = tmdb->search->file(filename); This allows you to search a movie by passing a file. The file's HashID and size is used to search TMDb. The search result returned is the same as ["movie(name)"](#movie(name)) movie ----- # Initialize using TMDb ID my $movie = $tmdb->movie($id); # Movie Information $movie->name(); # Get Movie name $movie->year(); # Release year $movie->released(); # Release date $movie->url(); # TMDb URL $movie->id(); # TMDb ID $movie->imdb_id(); # IMDB ID $movie->tagline(); # Movie tagline $movie->overview(); # Movie Overview/plot $movie->rating(); # Rating on TMDb $movie->runtime(); # Runtime $movie->trailer(); # link to YouTube trailer $movie->homepage(); # Official homepage $movie->certification(); # MPAA certification $movie->budget(); # Budget # Cast & Crew # All of these methods returns an array $movie->cast(); $movie->director(); $movie->producer(); $movie->writers(); # Images # Returns an array with image URLs $movie->posters($size) ; # Specify what size you want (original/mid/cover/thumb). Defaults to 'original' $movie->backdrops($size) ; # Specify what size you want (original/poster/thumb). Defaults to 'original' # Genres # Returns an array $movie->genres(); # Studios # Returns an array $movie->studios(); # ALl in one # Get a flattened hash containing all movie details my $info = $movie->info(); use Data::Dumper; print Dumper $info; person ------ # Initialize using TMDb ID my $person = $tmdb->person($id); # Details $person->name(); # Name $person->id(); # TMDb ID $person->bio(); # Biography $person->birthday(); # Birthday $person->url(); # TMDb profile URL # Filmography # Returns an array with movie names $person->movies(); # Images # Returns an array with image URLs $person->posters($size) ; # Specify what size (original/profile/thumb). Defaults to 'original' # ALl in one # Get a flattened hash containing all person details my $info = $person->info(); use Data::Dumper; print Dumper $info; DEPENDENCIES ============ Encode LWP::UserAgent YAML::Any BUGS AND LIMITATIONS ==================== Please report any bugs or feature requests to bug-tmdb@rt.cpan.org, or through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=TMDB AUTHOR ====== Mithun Ayachit mithun@cpan.org LICENSE AND COPYRIGHT ===================== Copyright (c) 2012, Mithun Ayachit. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.