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) client

VERSION

Version 0.04

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 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( query => 'Brad+Pitt' );

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

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

DESCRIPTION

This module implements version 3 of the TMDb API. See http://help.themoviedb.org/kb/api/about-3 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 corresponding method names in the TMDb API:

                                      TMDB API                           WWW::TMDB::API
                                      ----------------------             -------------------
    Search Movies                     search/movie                       movie->search() 
    Search People                     search/person                      person->search()
    Movie Info                        movie/[TMDb ID]                    movie->info()
    Movie Alternative Titles          movie/[TMDb ID]/alternative_titles movie->alternative_titles()
    Movie Casts                       movie/[TMDb ID]/casts              movie->casts()
    Movie Images                      movie/[TMDb ID]/images             movie->images()
    Movie Keywords                    movie/[TMDb ID]/keywords           movie->keywords()
    Movie Release Info                movie/[TMDb ID]/releases           movie->releases()
    Movie Trailers                    movie/[TMDb ID]/trailers           movie->trailers()
    Movie Translations                movie/[TMDb ID]/translations       movie->translations()
    Person Info                       person/[TMDb ID]/info              person->info()
    Person Credits                    person/[TMDb ID]/credits           person->credits()
    Person Images                     person/[TMDb ID]/images            person->images()
    Latest Movie                      latest/movie                       movie->latest()

The API requires an API key which can be generated from http://api.themoviedb.org. This module converts the API output to Perl data structure using the module JSON. This module does not support update the method, Movie Add Rating.

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 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->search( %params )

Searches for movies.

  • query

    Required. This is the search text. The query can include the year the movie was released (e.g. Transformers+2007) to narrow the search results.

  • page

    Optional. Use this parameter to iterate through the search results. Search results that exceed 20 items are paginated.

  • language

    Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.

  • include_adult

    Optional. [true/false, defaults to false if unspecified]. Set this to true to include adult items in the search results.

person->search( %params )

Searches for actors, actresses, or production members.

  • query

    Required. This is the search text.

  • page

    Optional. Use this parameter to iterate through the search results. Search results that exceed 20 items are paginated.

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

movie->info( %params )

Retrieves basic information about a movie. Building image urls from the file_paths returned by this method is discussed in the document http://help.themoviedb.org/kb/api/configuration.

  • ID

    Required. The TMDb ID of the movie.

  • language

    Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.

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

movie->alternative_titles( %params )

Retrieves a movie's alternative titles.

  • ID

    Required. The TMDb ID of the movie.

  • country

    Optional. This limits the result to items tagged with the specified country. The expected value is a ISO 3166-1 code.

        $result = $api->movie->alternative_titles( ID => 903 );
        $result = $api->movie->alternative_titles( ID => 903, 'language' => 'fr' );

movie->casts( %params )

Retrieves a movie's cast information.

  • ID

    Required. The TMDb ID of the movie.

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

movie->images( %params )

Retrieves all of the images for a particular movie. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration

  • ID

    Required. The TMDb ID of the movie.

  • language

    Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.

        $result = $api->movie->images( ID => 903 );
        $result = $api->movie->images( ID => 903, 'language' => 'en' );

movie->keywords( %params )

Retrieves the keywords for a movie.

  • ID

    Required. The TMDb ID of the movie.

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

movie->releases( %params )

Retrieves release and certification data for a specific movie.

  • ID

    Required. The TMDb ID of the movie.

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

movie->trailers( %params )

Retrieves the trailers for a movie.

  • ID

    Required. The TMDb ID of the movie.

  • language

    Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.

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

movie->translations( %params )

Retrieves the list of translations for a movie.

  • ID

    Required. The TMDb ID of the movie.

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

person->info( %params )

Retrieves basic information about a person. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration

  • ID

    Required. The TMDb ID of the person.

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

person->credits( %params )

Retrieves the movies that have cast or crew credits for a person.

  • ID

    Required. The TMDb ID of the person.

  • language

    Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.

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

person->images( %params )

Retrieves all the profile images of the person. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration]

  • ID

    Required. The TMDb ID of the person.

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

movie->latest( )

Returns the newest movie created in the themoviedb.org database.

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 224:

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