Ticket #3672: patch_runtimes.txt

File patch_runtimes.txt, 842 bytes (added by aprotim@…, 18 years ago)
Line 
1--- imdb.pl.orig 2007-06-10 15:45:06.000000000 -0400
2+++ imdb.pl 2007-06-27 03:19:17.000000000 -0400
3@@ -31,6 +31,7 @@
4 use HTML::Entities;
5 use URI::Escape;
6
7+my @countries = qw(USA UK Canada Japan);
8
9 use vars qw($opt_h $opt_r $opt_d $opt_i $opt_v $opt_D $opt_M $opt_P);
10 use Getopt::Std;
11@@ -185,9 +186,12 @@
12 }
13
14 # parse movie length
15- my $runtime = trim(parseBetween($response, ">Runtime:</h5>", " min"));
16- unless ($runtime =~ /^-?\d/) {
17- $runtime = trim(parseBetween($response, "USA:", " min"));
18+ my $rawruntime = trim(parseBetween($response, ">Runtime:</h5>", "</div>"));
19+ my $runtime = trim(parseBetween($rawruntime, "", " min"));
20+ for my $country (@countries)
21+ {
22+ last if ($runtime =~ /^-?\d/) ;
23+ $runtime = trim(parseBetween($rawruntime, "$country:", " min"));
24 }
25
26 # parse cast