NAME
TVDB::API - API to www.thetvdb.com
SYNOPSIS
use TVDB::API;
my $tvdb = TVDB::API::new([[$apikey], $language]);
$tvdb->setApiKey($apikey);
$tvdb->setLang('en');
$tvdb->setUserAgent("TVDB::API/$VERSION");
$tvdb->setBannerPath("/foo/bar/banners");
$tvdb->setCacheDB("$ENV{HOME}/.tvdb.db");
my $hashref = $tvdb->getAvailableMirrors([$nocache]);
$tvdb->setMirrors($mirror, [$banner, [$zip]]);
$tvdb->chooseMirrors([$nocache]);
$tvdb->getAvailableLanguages([$nocache]);
$tvdb->getUpdates([$period]);
my $series_id = $tvdb->getSeriesId($series_name, [$nocache]);
my $name = $tvdb->getSeriesName($series_id, [$nocache]);
my $hashref = $tvdb->getSeries($series_name, [$nocache]);
my $hashref = $tvdb->getSeriesAll($series_name, [$nocache]);
my $hashref = $tvdb->getSeriesActors($series_name, [$nocache]);
my $hashref = $tvdb->getSeriesBanners($series_name, $type, $type2, $value, [$nocache]);
my $hashref = $tvdb->getSeriesInfo($series_name, [$nocache]);
my $banner = $tvdb->getSeriesBanner($series_name, [$nocache]);
my $fanart = $tvdb->getSeriesFanart($series_name, [$nocache]);
my $poster = $tvdb->getSeriesPoster($series_name, [$nocache]);
my $string = $tvdb->getSeriesOverview($series_name, [$nocache]);
my $picture = $tvdb->getBanner($banner, [$nocache]);
my $int = $tvdb->getMaxSeason($series, [$nocache]);
my $hashref = $tvdb->getSeason($series, $season, [$nocache]);
my @picture_names = $tvdb->getSeasonBanners($series, $season, [$nocache]);
my $picture = $tvdb->getSeasonBanner($series, $season, [$nocache]);
my @picture_names = $tvdb->getSeasonBannersWide($series, $season, [$nocache]);
my $picture = $tvdb->getSeasonBannerWide($series, $season, [$nocache]);
my $int = $tvdb->getMaxEpisode($series, $season, [$nocache]);
my $hashref = $tvdb->getEpisode($series, $season, $episode, [$nocache]);
my $hashref = $tvdb->getEpisodeId($episodeid, [$nocache]);
my $string = $tvdb->getEpisodeInfo($series, $season, $episode, $info, [$nocache]);
my $picture = $tvdb->getEpisodeBanner($series, $season, $episode, [$nocache]);
my $string = $tvdb->getEpisodeName($series, $season, $episode, [$nocache]);
my $string = $tvdb->getEpisodeOverview($series, $season, $episode, [$nocache]);
$tvdb->dumpCache();
DESCRIPTION
This module provides an API to the TVDB database through the new published API.
- $tvdb = TVDB::API::new([APIKEY, [LANGUAGE]])
-
Create a TVDB::API object using
APIKEY
and using a default language ofLANGUAGE
. Both these arguments are optional. - setApiKey(APIKEY);
-
Set the
APIKEY
to be used to access the web api for thetvdb.com - setLang(LANGUAGE);
-
Set the
LANGUAGE
to use when downloading data from thetvdb.com - setUserAgent(USERAGENT);
-
Set the
USERAGENT
to be used when downloading information from thetvdb.com - setBannerPath(PATH);
-
Set the path in which to save downloaded banner graphics files.
- setCacheDB("$ENV{HOME}/.tvdb.db");
-
Set the name of the database file to be used to save data from thetvdb.com
- getAvailableMirrors([NOCACHE]);
-
Get the list of mirror sites available from thetvdb.com. It returns a hashref of arrays. If
NOCACHE
is non-zero, then the mirrors are downloaded again even if they are in the cache database already.Returns: { xml => @xml_mirrors, banner => @banner_mirrors, zip => @zip_mirrors, }
- setMirrors(MIRROR, [BANNER, [ZIP]]);
-
Set the mirror site(s) to be used to download tv info. If
BANNER
orZIP
or not specified, thenMIRROR
is used instead. - chooseMirrors([NOCACHE]);
-
Choose a random mirror from the list of available mirrors. If
NOCACHE
is non-zero, then the mirrors are downloaded again even if they are in the cache database already. - getAvailableLanguages([NOCACHE]);
-
Get a list of available languages, and return them in a hashref. If
NOCACHE
is non-zero, then the available languages are downloaded again even if they are in the cache database already. - getUpdates([PERIOD]);
-
Get appropriate updates (day/week/month/all) from thetvdb.com based on the specified
PERIOD
. It then downloads updates for series, episodes, and banners which have already been downloaded.day
-
Get the updates for the last 24 hours (86400 seconds).
week
-
Get the updates for the last week (7 days, or 604800 seconds).
month
-
Get the updates for the last month (30 days, or 2592000 seconds).
all
-
Get all updates available.
now
-
Based on the last update performed, determine whether to do a day, week, month or all update.
guess
-
Like
now
, based on the last update performed, determine whether to do a day, week, month or all update. However, if the last update was performed in the last 6 hours, do nothing. This is the defaultPERIOD
If
NOWAIT
is non-zero, then get updates despite having checked recently. - getSeriesId(SERIESNAME, [NOCACHE]);
-
Get the series id (an integer) for
SERIESNAME
from thetvtb.com. IfNOCACHE
is non-zero, then the series id is downloaded again even if it is in the cache database already. - getSeriesName(SERIESID, [NOCACHE]);
-
Get the series name (a string) for
SERIESID
. IfNOCACHE
is non-zero, then the series name is downloaded again even if it is in the cache database already. - getSeries(SERIESNAME, [NOCACHE]);
-
Get the series info for
SERIESNAME
from thetvtb.com, which is returned as a hashref. IfNOCACHE
is non-zero, then the series info is downloaded again even if it is in the cache database already. - getSeriesAll(SERIESNAME, [NOCACHE]);
-
Get the series info, and all episodes for
SERIESNAME
from thetvtb.com, which is returned as a hashref. IfNOCACHE
is non-zero, then the series info and episodes are downloaded again even if they are in the cache database already. - getSeriesActors(SERIESNAME, [NOCACHE]);
-
Get the actors for
SERIESNAME
from thetvtb.com, which is returned as a hashref. IfNOCACHE
is non-zero, then the list of actors are downloaded again even if they are in the cache database already. - getSeriesBanners(SERIESNAME, TYPE, TYPE2, VALUE, [NOCACHE]);
-
Get the banners for
SERIESNAME
from thetvtb.com. Info about the available banners are returned in a hashref. The actual banners can be downloaded individually withgetBanner
(see below). IfNOCACHE
is non-zero, then the list of banners are downloaded again even if they are in the cache database already.if
TYPE
is specified (series, season, poster, or fanart) then only return banners of that type. ifTYPE2
is specified then only return banners of that sub type. IfTYPE
is "series" thenTYPE2
can be "text", "graphical", or "blank". IfTYPE
is "season" thenTYPE2
can be "season", or "seasonwide" andVALUE
specifies the season number. IfTYPE
is "fanart" thenTYPE2
is the desired resolution of the image. - getSeriesInfo(SERIESNAME, KEY, [NOCACHE]);
-
Return a string for
KEY
in the hashref forSERIESNAME
. IfNOCACHE
is non-zero, then the series is downloaded again even if it is in the cache database already. - getSeriesBanner(SERIESNAME, [NOCACHE]);
-
Get the series banner from thetvdb.com and return it as a binary blob. If
NOCACHE
is non-zero, then the banner is downloaded again even if it is in theBannerPath
directory already. - getSeriesFanart(SERIESNAME, [NOCACHE]);
-
Get the series fan art from thetvdb.com and return it as a binary blob. If
NOCACHE
is non-zero, then the fan art is downloaded again even if it is in theBannerPath
directory already. - getSeriesPoster(SERIESNAME, [NOCACHE]);
-
Get the series poster from thetvdb.com and return it as a binary blob. If
NOCACHE
is non-zero, then the poster is downloaded again even if it is in theBannerPath
directory already. - getSeriesOverview(SERIESNAME, [NOCACHE]);
-
Get the series overview from thetvdb.com and return it as a string. If
NOCACHE
is non-zero, then the banner is downloaded again even if it is in the cache database already. - getBanner(BANNER, [NOCACHE]);
-
Get the
BANNER
from thetvdb.com and return it as a binary blob. IfBannerPath
is set (viasetBannerPath
), then the banner is saved/cached in that directory structure and updated viagetUpdates
when appropriate. IfNOCACHE
is non-zero, then the banner is downloaded again even if it is in theBannerPath
directory already. - getMaxSeason(SERIESNAME, [NOCACHE]);
-
Return the number of the last season for
SERIESNAME
. IfNOCACHE
is non-zero, then any series info needed to calculate this is downloaded again even if it is in the cache database already. - getSeason(SERIESNAME, SEASON, [NOCACHE]);
-
Return a hashref of episodes in
SEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then any episodes needed for this season is downloaded again even if it is in the cache database already. - getSeasonBanners(SERIESNAME, SEASON, [NOCACHE]);
-
Return an array of banner names for
SEASON
forSERIESNAME
. These names can get used withgetBanner()
to actually download the banner file. IfNOCACHE
is non-zero, then any data needed for this is downloaded again even if it is in the cache database already. - getSeasonBanner(SERIESNAME, SEASON, [NOCACHE]);
-
Return a random banner (binary blob) for
SEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then any episodes needed for this season is downloaded again even if it is in theBannerPath
directory already. - getSeasonBannersWide(SERIESNAME, SEASON, [NOCACHE]);
-
Return an array of wide banner names for
SEASON
forSERIESNAME
. These names can get used withgetBanner()
to actually download the banner file. IfNOCACHE
is non-zero, then any data needed for this is downloaded again even if it is in theBannerPath
directory already. - getSeasonBannerWide(SERIESNAME, SEASON, [NOCACHE]);
-
Return a random wide banner (binary blob) for
SEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then any episodes needed for this season is downloaded again even if it is in theBannerPath
directory already. - getMaxEpisode(SERIESNAME, SEASON, [NOCACHE]);
-
Return the number episodes in
SEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then any series info needed to calculate this is downloaded again even if it is in the cache database already. - getEpisode(SERIESNAME, SEASON, EPISODE, [NOCACHE]);
-
Return a hashref for the
EPISODE
inSEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then the episode is downloaded again even if it is in the cache database already. - getEpisodeId(EPISODEID, [NOCACHE]);
-
Return a hashref for the episode indicated by
EPISODEID
. IfNOCACHE
is non-zero, then the episode is downloaded again even if it is in the cache database already. - getEpisodeInfo(SERIESNAME, SEASON, EPISODE, KEY, [NOCACHE]);
-
Return a string for
KEY
in the hashref forEPISODE
inSEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then the episode is downloaded again even if it is in the cache database already. - getEpisodeBanner(SERIESNAME, SEASON, EPISODE, [NOCACHE]);
-
Return the episode banner (binary blob) for
EPISODE
inSEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then the banner is downloaded again even if it is in theBannerPath
directory already. - getEpisodeName(SERIESNAME, SEASON, EPISODE, [NOCACHE]);
-
Return the episode name for
EPISODE
inSEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then the episode is downloaded again even if it is in the cache database already. - getEpisodeOverview(SERIESNAME, SEASON, EPISODE, [NOCACHE]);
-
Return the overview for
EPISODE
inSEASON
forSERIESNAME
. IfNOCACHE
is non-zero, then the episode is downloaded again even if it is in the cache database already. - dumpCache()
-
Dump the cache database with Dumper to stdout.
EXAMPLE
my $episode = $tvdb->getEpisode('Lost', 3, 5); print Dumper($episode);
$episode = {
'lastupdated' => '1219734325',
'EpisodeName' => 'The Cost of Living',
'seasonid' => '16270',
'Overview' => 'A delirious Eko wrestles with past demons; some of the castaways go to the Pearl station to find a computerthey can use to locate Jack, Kate and Sawyer; Jack does not know who to trust when two of the Others are at odds with each other.
',
'filename' => 'episodes/73739-308051.jpg',
'EpisodeNumber' => '5',
'Language' => 'en',
'Combined_season' => '3',
'FirstAired' => '2006-11-01',
'seriesid' => '73739',
'Director' => 'Jack Bender',
'SeasonNumber' => '3',
'Writer' => 'Monica Owusu-Breen, Alison Schapker',
'GuestStars' => '|Olalekan Obileye| Kolawole Obileye Junior| Alicia Young| Aisha Hinds| Lawrence Jones| Ariston Green| Michael Robinson| Jermaine|',
'Combined_episodenumber' => '5'
};
AUTHOR
Behan Webster <behanw@websterwood.com<gt>
COPYRIGHT
Copyright (c) 2008 Behan Webster. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.