The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::TMDB::API - TMDb API (http://api.themoviedb.org/2.1/) client

VERSION

Version 0.02

SYNOPSIS

        use WWW::TMDB::API;

        # The constructor has 2 parameters - the api_key and the optional LWP::UserAgent object, ua.
        my $tmdb_client = WWW::TMDB::API->new( 'api_key' => 'your tmdb api key' );

        #  Retrieve specific information about the person with ID == 287
        $tmdb_client->person->info( ID => 287 );

        # Searches the themoviedb.org database for an actor, actress or production member with name 'Brad+Pitt'
        $tmdb_client->person->search( Name => 'Brad+Pitt' );

        # Searches the themoviedb.org database for an actor, actress or production member with name 'Brad'
        $tmdb_client->person->search( Name => 'Brad' );

        #  Search for a movie based on its IMDb ID.
        $tmdb_client->movie->imdb_lookup( 'IMDB ID' => 'tt0137523' );

        #  Determine the last movie created in the themoviedb.org database.
        $tmdb_client->movie->latest();

        #  Determine the last person(actor/actress/production member) created in the themoviedb.org database.
        $tmdb_client->person->latest();

DESCRIPTION

This module implements version 2.1 of the TMDb API. See http://api.themoviedb.org/2.1/ for the documentation. The module uses the same parameter names used by the API. The method names have been slightly changed. Here's the mapping of the method names used by this this module and the actual method names in the TMDb API:

    TMDb API             WWW::TMDB::API
    --------------       --------------------
    Media.getInfo        media->info()
    Movie.browse         movie->browse()
    Movie.getImages      movie->images()
    Movie.getInfo        movie->info()
    Movie.getLatest      movie->latest()
    Movie.getVersion     movie->version()
    Movie.imdbLookup     movie->imdb_lookup()
    Movie.search         movie->search()
    Person.getInfo       person->info()
    Person.getLatest     person->latest()
    Person.getVersion    person->version()
    Person.search        person->search()
    Genres.getList       misc->genres()

The API requires an API key which can be generated from http://api.themoviedb.org/2.1/.

This module converts the API output to Perl data structure using the module JSON.

This module does not support update methods, Media.addID and Movie.addRating.

SUBROUTINES/METHODS

new( %params )

Returns a new instance of the WWW::TMDB::API class.

  • api_key

    Required. This is the TMDb API key. Go to the http://api.themoviedb.org/2.1/ to signup and generate an API key.

  • ua

    Optional. The LWP::UserAgent used to communicate with the TMDb server.

            my $tmdb_client = WWW::TMDB::API->new( 'api_key' => 'your tmdb api key' );
    
    
            require LWP::UserAgent;
            $ua = LWP::UserAgent->new(
                    'agent'        => "Perl-WWW-TMDB-API",
            );
    
            my $tmdb_client =
                    WWW::TMDB::API->new( 'api_key' => 'your tmdb api key', 'ua' => $ua );

movie->browse( %params )

Queries the themoviedb.org database using a set of parameters/filters.

  • order_by

    Required. (3 options: rating, release, title)

  • order

    Required. (2 options: asc, desc)

  • per_page, page, query, min_votes, rating_min,rating_max, genres, genres_selector, release_min, release_max, year, certifications, companies, countries

    Optional.

    The Movie.browse documentation at http://api.themoviedb.org/2.1/methods/Movie.browse describes the the parameters/filters in detail.

        $result = $api->movie->browse(
           'query'    => 'Cool Hand Luke',
           'order_by' => 'title',
           'order'    => 'desc'
        );

movie->images( %params )

Searches the TMDb database for images that matches the given ID.

  • ID

    Required. The TMDb ID OR IMDB ID (starting with tt) of the movie. Retrieves all images(backdrops, posters) for a particular movie.

        $result = $api->movie->images( 'ID' => 'tt0061512' );
        $result = $api->movie->images( 'ID' => 903 );

movie->info( %params )

Retrieves specific information about the movie that matches the given ID.

  • ID

    Required. The TMDb ID of the movie.

        $result = $api->movie->info( 'ID' => 903 );

movie->latest( )

Returns the TMDb ID of the last movie created in the themoviedb.org database.

movie->version( %params )

This method will be useful when checking for updates. Retrieves the last modified time and version number of the movie with the given ID.

  • ID

    Required. The TMDb ID of the movie. This field can contain the TMDb movie id (integer value), an IMDB ID, or a comma-separated list of IDs. The list of IDs can have a combination of TMDB and IMDB IDs.

         $result = $api->movie->version( 'ID' => 'tt0061512,94744' );

movie->imdb_lookup( %params )

Searches the themoviedb.org database using the movie's IMDB ID.

  • IMDB ID

    Required. The IMDB ID of the movie.

movie->search( %params )

Searches for movies that match the given Title.

  • Title

    Required. The title of the movie. The title can include the year the movie was released (e.g. Transformers+2007) to narrow the search results.

person->info( %params )

Retrieves specific information about the person that matches the given ID.

  • ID

    Required. The TMDb ID of the person.

         $result = $api->person->info( 'ID' => 3636 );

person->latest( )

Returns the ID of the last person created in the themoviedb.org database.

person->version( %params )

This method will be useful when checking for updates. Retrieves the last modified time and version number of the persion with the given ID.

  • ID

    Required. The TMDb ID of the person. This field supports an integer value (TMDb person id) or a comma-separated list of person IDs if you are searching for multiple people.

         $result = $api->person->version( ID => 3636 );

person->search( %params )

Searches for actors, actresses, or production members that match the given Name.

  • Name

    Required.

        $result = $api->person->search( 'Name' => 'Newman' );

misc->genres( )

Retrieves a list of valid genres within TMDb.

        $result = $api->misc->genres();

AUTHOR

Maria Celina Baratang, <maria at zambale.com>

BUGS

Please report any bugs or feature requests to bug-www-tmdb-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-TMDB-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::TMDB::API

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Maria Celina Baratang.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 305:

=back doesn't take any parameters, but you said =back $result = $api->movie->imdb_lookup( 'IMDB ID' => 'tt0061512' );

Around line 318:

=back doesn't take any parameters, but you said =back $result = $api->movie->search( 'Title' => 'Cool Hand' );