WebService::TVRage::EpisodeList - Object returned by WebService::TVRage::EpisodeListRequest, Contains a List of episodes for all seasons


WebService-TVRage documentation Contained in the WebService-TVRage distribution.

Index


Code Index:

NAME

Top

WebService::TVRage::EpisodeList - Object returned by WebService::TVRage::EpisodeListRequest, Contains a List of episodes for all seasons

SYNOPSIS

Top

    my $heroes = WebService::TVRage::EpisodeListRequest->new();
    $heroes->episodeID('8172'); 
    my $episodeList = $heroes->getEpisodeList();
	$episodeList->getNumSeasons();

Methods

Top

_episodeListHash

This is populated by WebService::TVRage::EpisodeListRequest, you shouldn't need to edit this, but you might want to look at it with Data::Dumper

getNumSeasons()

    $episodeList->getNumSeasons()

Returns the number of Seasons there have been for the show.

getNumEpsInSeasons()

    $episodeList->getNumSeasons('2')

Returns the number of episodes for whatever season is specified as an argument.

getEpisode()

    $episodeList->getEpisode(1,3)

Takes two arguments, season then Episode number and returns a WebService::TVRage::Episode object for that episode.

AUTHOR

Top

Kyle Brandt, kyle@kbrandt.com http://www.kbrandt.com


WebService-TVRage documentation Contained in the WebService-TVRage distribution.

#===============================================================================
#         FILE:  EpisodeList.pm
#       AUTHOR:  Kyle Brandt (mn), kyle@kbrandt.com , http://www.kbrandt.com
#      COMPANY:  Home
#===============================================================================

use strict;
use warnings;

package WebService::TVRage::EpisodeList;
use Mouse;
use WebService::TVRage::Episode;
use Data::Dumper;
has '_episodeListHash' => ( is => 'rw' );

sub getNumSeasons {
	my $self = shift;	
	my $noSeasons = $self->_episodeListHash()->{totalseasons} // '';
	return $noSeasons;
}

sub getNumEpsInSeason {
	my $self = shift;
	my $season = shift;
	$season -= 1;
	return 0 unless defined $self->_episodeListHash()->{Episodelist}{Season}[$season];
	my $noEps =  @{$self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}} // '';
	return $noEps;
}

sub getEpisode {
	my $self = shift;
	my $season = shift;
	my $episode = shift;
	$episode--; $season--;
	my $object =  WebService::TVRage::Episode->new();
	return undef unless defined $self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}[$episode];	
	$object->_episodeHash($self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}[$episode]);
	return $object;
}

1;