Subject: | Failure to find a film cover for 'Wall-E', and fix |
Fun one for cover fetching which wasn't obvious until I noticed that
Wall-E didn't have a cover returned...
In sub cover it looks for an img with the same alt text as the film
title. Which is cute. But the title has had special characters replaced
- in particular the middot is replaced, which means that when compared,
it doesn't match. 'WALL¿E' is not the same as 'WALL*E'.
My proposed fix is relatively simple - we replace the check with one
that does the same special symbol replacement (and a small amount of
extra debug to help diagnose the problem):
(apologies for formatting below)
my $alt = $img_tag->[1]{alt} || '';
# Apply the same decoding as the title (otherwise 'Wall<mid-dot>E'
doesn't work)
$alt = $self->_decode_special_symbols($alt);
$self->_show_message("Cover: Found '$alt'", 'DEBUG');
last if $alt =~ /^poster not submitted/i;
if($alt =~ /^$title$/i) {
$cover = $img_tag->[1]{src};
last;
}
additionally, we could save a regular expression match by using $title
= lc ... and if (lc $alt eq $title), but that's not too important
really.
I've not checked back beyond 0.42, which I'm using, but I have checked
0.43 and the code appears unchanged in there so I guess it's still like
that.
Hope that helps, and that you had a good Christmas and New Year :-)