Subject: | Episode Data missing |
TV::Series is able to look up a series and find an episode list, looking
up an individual episode by ID works, but none of the fields are filled
in (only id and name are filled in).
I attached the test code I am using. The $title and $subtitle variables
are the Series name and Episode name. String::Approx is doing the
episode name matching. The example episode "Family Guy - Peter's Two
Dad's" is found as an exact match, episode ID 904190. None of the
(summary, episode number, season number, etc) details are being filled in.
Subject: | series_test.pl |
#!/usr/bin/perl
use WWW::TV::Series qw();
use String::Approx 'adist';
$title="Family Guy";
$subtitle="Peter's Two Dads";
print "Looking up $title...\n";
my $series = WWW::TV::Series->new(name=>$title);
my @episodes = $series->episodes;
print "Found " . @episodes . " episodes\n";
print "Looking up '$subtitle'...\n";
my $found_episode;
my $match_score=100;
foreach my $episode (@episodes)
{
my $test_match_score = abs(adist($episode->{name}, $subtitle));
if ($test_match_score < $match_score)
{
$found_episode = $episode;
$match_score = $test_match_score;
}
}
if ($match_score < 5)
{
# Pretty good match, we'll take it!
$episode_id = $found_episode->{id};
my $found_episode = WWW::TV::Episode->new(id => $episode_id);
$subtitle = $found_episode->name;
print "Found: $subtitle (score $match_score)\n";
$description = $found_episode->{summary};
$season_number = $found_episode->{season_number};
$episode_number = $found_episode->{episode_number};
}
else
{
print "Episode not found, not filling in meta data\n"
}
print " Title: $title - $subtitle\n";
print " Episode ID: $episode_id\n";
print " Desc: $description\n";
print " Season: $season_number\n";
print " Episode: $episode_number\n";