Skip Menu |
 

This queue is for tickets about the IMDB-Film CPAN distribution.

Report information
The Basics
Id: 63588
Status: open
Priority: 0/
Queue: IMDB-Film

People
Owner: Nobody in particular
Requestors: 2ge [...] 2ge.us
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.49
Fixed in: (no value)



Subject: Retrieving all AKAs for movie
Download (untitled) / with headers
text/plain 587b
Hi, there will be nice, if would be possible to retrieve all movies "also known as". Here is code: my $crit = '0064843'; my $aka = $imdb->also_known_as(); print map { "$_\n" } @$aka; prints only "A Case for a Young Hangman", but on http://www.imdb.com/title/tt0064843/releaseinfo#akas are these: A Case for a Young Hangman (undefined) Case for a Rookie Hangman International (English title) Le cas de l'apprenti bourreau France Przypadek dla poczatkujacego kata Poland Un cas pour un bourreau débutant France (DVD title) I know there is needed one more http request. Thanks!
From: brainkiller [...] gmail.com
Download (untitled) / with headers
text/plain 177b
Hello, I've patched Film.pm to allow this. I've also attached the patched Film.pm and the patch for the lazy people that like to just download and run it. Regards, Brainkiller
Subject: akas.patch
Download akas.patch
text/x-diff 2k
*** Film.pm 2010-12-23 14:33:36.000000000 +0100 --- /home/brainkiller/Desktop/Film.pm 2010-11-26 10:23:47.000000000 +0100 *************** *** 1159,1198 **** sub also_known_as { my CLASS_NAME $self= shift; ! unless($self->{_also_known_as}) { ! my $page; ! $page = $self->_cacheObj->get($self->code . '_releaseinfo') if $self->_cache; ! ! unless($page) { ! my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/releaseinfo"; ! $self->_show_message("URL for movie releaseinfo is $url ...", 'DEBUG'); ! ! $page = $self->_get_page_from_internet($url); ! $self->_cacheObj->set($self->code.'_releaseinfo', $page, $self->_cache_exp) if $self->_cache; ! } ! ! my $parser = $self->_parser(FORCED, \$page); ! ! my @result; ! my @lookFor = ('a'); ! my $found = 0; ! while (my $tag = $parser->get_tag(@lookFor)) { ! if ($tag->[0] eq 'a' && defined($tag->[1]->{name}) && $tag->[1]->{name} eq 'akas') { ! $self->_show_message("Start search for AKA.", 'DEBUG'); ! $found = 1; ! @lookFor = ('tr', '/table'); ! } elsif ($found && $tag->[0] eq 'tr') { ! my $aka = $parser->get_trimmed_text("/td"); ! $self->_show_message("AKA: $aka", 'DEBUG'); ! push @result, $aka; ! } elsif ($found) { ! # Stop when we hit the divider ! last; ! } ! } ! $self->{_also_known_as} = \@result; ! } return $self->{_also_known_as}; } --- 1159,1180 ---- sub also_known_as { my CLASS_NAME $self= shift; + unless($self->{_also_known_as}) { + my $parser = $self->_parser(FORCED); ! while(my $tag = $parser->get_tag(MAIN_TAG)) { ! my $text = $parser->get_text(); ! $self->_show_message("AKA: $text", 'DEBUG'); ! last if $text =~ /^(aka|also known as)/i; ! } ! ! my $aka = $parser->get_trimmed_text('span'); ! ! $self->_show_message("AKA: $aka", 'DEBUG'); ! my @aka = ($aka); ! $self->{_also_known_as} = \@aka; ! } ! return $self->{_also_known_as}; }
Subject: Film.pm
Download Film.pm
text/x-perl 37.5k

Message body is not shown because it is too large.

From: brainkiller [...] gmail.com
Download (untitled) / with headers
text/plain 414b
Hello, I've added this to Film.pm in order to get the full info for each alternative title. At first I didn't thought I'd use it but now I do need it. ! } elsif ($found && $tag->[0] eq 'tr') { ! my $aka = $parser->get_trimmed_text("/td"); $parser->get_text("td"); my $info = $parser->get_trimmed_text("/td"); ! $self->_show_message("AKA: $aka", 'DEBUG'); ! push @result, "\"$aka\" - $info"; ! } elsif ($found) {
From: brainkiller [...] gmail.com
Download (untitled) / with headers
text/plain 298b
On Thu Dec 23 15:24:05 2010, brainkiller wrote: Show quoted text
> Hello, > > I've added this to Film.pm in order to get the full info for each > alternative title. At first I didn't thought I'd use it but now I do > need it. >
Attached is the proper patch agains 0.49 and again the Film.pm for the lazy people.
Subject: akas.patch
Download akas.patch
text/x-diff 2.1k
*** lib/IMDB/Film.pm 2010-12-23 21:20:19.000000000 +0100 --- /home/brainkiller/Downloads/IMDB-Film-0.49/lib/IMDB/Film.pm 2010-11-26 10:23:47.000000000 +0100 *************** *** 1159,1200 **** sub also_known_as { my CLASS_NAME $self= shift; ! unless($self->{_also_known_as}) { ! my $page; ! $page = $self->_cacheObj->get($self->code . '_releaseinfo') if $self->_cache; ! ! unless($page) { ! my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/releaseinfo"; ! $self->_show_message("URL for movie releaseinfo is $url ...", 'DEBUG'); ! ! $page = $self->_get_page_from_internet($url); ! $self->_cacheObj->set($self->code.'_releaseinfo', $page, $self->_cache_exp) if $self->_cache; ! } ! ! my $parser = $self->_parser(FORCED, \$page); ! ! my @result; ! my @lookFor = ('a'); ! my $found = 0; ! while (my $tag = $parser->get_tag(@lookFor)) { ! if ($tag->[0] eq 'a' && defined($tag->[1]->{name}) && $tag->[1]->{name} eq 'akas') { ! $self->_show_message("Start search for AKA.", 'DEBUG'); ! $found = 1; ! @lookFor = ('tr', '/table'); ! } elsif ($found && $tag->[0] eq 'tr') { ! my $aka = $parser->get_trimmed_text("/td"); ! $parser->get_text("td"); ! my $info = $parser->get_trimmed_text("/td"); ! $self->_show_message("AKA: $aka", 'DEBUG'); ! push @result, "\"$aka\" - $info"; ! } elsif ($found) { ! # Stop when we hit the divider ! last; ! } ! } ! $self->{_also_known_as} = \@result; ! } return $self->{_also_known_as}; } --- 1159,1180 ---- sub also_known_as { my CLASS_NAME $self= shift; + unless($self->{_also_known_as}) { + my $parser = $self->_parser(FORCED); ! while(my $tag = $parser->get_tag(MAIN_TAG)) { ! my $text = $parser->get_text(); ! $self->_show_message("AKA: $text", 'DEBUG'); ! last if $text =~ /^(aka|also known as)/i; ! } ! ! my $aka = $parser->get_trimmed_text('span'); ! ! $self->_show_message("AKA: $aka", 'DEBUG'); ! my @aka = ($aka); ! $self->{_also_known_as} = \@aka; ! } ! return $self->{_also_known_as}; }
Subject: Film.pm
Download Film.pm
text/x-perl 37.6k

Message body is not shown because it is too large.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.