Help a non-Perl user update an older program...

  • Thread starter Nathan Childress
  • Start date
N

Nathan Childress

There's a popular (and very nice) Perl program called "Showtimes" that
grabs movie listings off of the internet and converts them to Palm PDA
files. It's currently unsupported, and its link to IMDB doesn't work
anymore. I don't program in Perl, but looking through the code I
think I found the problem lines, although I have no idea how to fix
them. The problem (I think) is that IMDB used to have links to movies
in the form of "http://www.imdb.com/title?1234", but now it uses
"http://www.imdb.com/title/tt1234". Also, the plot summary used to be
found at "http://us.imdb.com/Plot?1234", whereas now it's at
"http://us.imdb.com/title/tt1234/plotsummary". Here is the the
relevant portion of the old code:

==========================
# This URL still works, I think
my $URL = 'http://us.imdb.com/Tfuzzy?title=' . $safetitle .
"&type=$st&sort=chrono&tv=off";

my $content = grabpage ( $URL, 1 );

last SEARCHTYPE unless ( defined ( $content ));

# Search for the first entry in the Movies section.
if (( $content =~ s|^.*?<A NAME=\"mov\">||s ) &&
( $content =~ m|<A HREF=\"/Title\?(.*?)\">(.*?)</A>| ))
{
$number = $1;
$match = $2;

# Grab the main details page.
$content = grabpage ( "http://us.imdb.com/Title/$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));

print " [$match]";

$EMCache { Movies }{ $title }{ Data } .= "$match";
$EMCache { Movies }{ $title }{ LastAccess } = time ();
$EMCache { Movies }{ $title }{ OnDevice } = 0;

# Check for a plot summary ...
if ( $content =~ /<B CLASS=\"ch\">Plot Summary: / )
{
$content = grabpage ( "http://us.imdb.com/Plot?$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));

if ( $content =~ /<P CLASS=\"plotpar\">(.*?)<\/P>/s )
{
my $plot = $1;
$plot =~ s/<.*?>//sg;
$plot =~ tr/\012/ /;
$EMCache { Movies }{ $title }{ Data } .= "\012$plot";
if ( $content =~ /Summary written by <.*?> (.*?)<\/A><\/P>/s )
{
my $cred = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012Summary by
$cred";
}
$found = 1;
}
}

# ... or a plot outline.
elsif ( $content =~ /<B CLASS=\"ch\">Plot Outline: <\/B>(.*?)[
\(]+</s )
{
my $outline = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012$outline";
$found = 1;
}

last SEARCHTYPE;
}
}
==========================

The full original program (highly recommended) can be found at
http://showtimes.jrray.org/. I have no idea how to use Perl to fix
the code, but I assume it would be useful to a lot of people. I just
thought that if anyone was interested, this might not be so hard to
fix.
 
J

James E Keenan

Nathan Childress said:
There's a popular (and very nice) Perl program called "Showtimes" that
grabs movie listings off of the internet and converts them to Palm PDA
files. It's currently unsupported, and its link to IMDB doesn't work
anymore. I don't program in Perl, but looking through the code I
think I found the problem lines, although I have no idea how to fix
them. The problem (I think) is that IMDB used to have links to movies
in the form of "http://www.imdb.com/title?1234", but now it uses
"http://www.imdb.com/title/tt1234". Also, the plot summary used to be
found at "http://us.imdb.com/Plot?1234", whereas now it's at
"http://us.imdb.com/title/tt1234/plotsummary". Here is the the
relevant portion of the old code:
Assuming that the problem is located in the section of the code you
supplied, what happens if you make the following 2 substitutions:

$content = grabpage ( "http://us.imdb.com/title/tt$number", 1 );

.... and later ...
$content = grabpage ( "http://us.imdb.com/Plot?$number", 1 );

$content = grabpage ( "http://us.imdb.com/title/tt$number/plotsummary",
1 );

I don't have a Palm so there's no way for me to truly test this out. For it
to work, Google's "fuzzy search" implied in this line of code must probably
be unchanged:
"&type=$st&sort=chrono&tv=off";

jimk
 
S

Steve

Hi - I also use this program and am interested in a fix.
Unfortunately, I know nothing of Perl...

I was wondering if the suggestion above helped? I may be able to
enlist some help from some Perl friends...

Thanks,
Steve
 
T

Tintin

Steve said:
Hi - I also use this program and am interested in a fix.
Unfortunately, I know nothing of Perl...

*this* program being....??? Obviously you know nothing about NG etiquette
as well.

I was wondering if the suggestion above helped? I may be able to
enlist some help from some Perl friends...

There is no suggestion above. Are you blind as well as stupid?
 
N

Nathan Childress

The above suggestion didn't help, but I did fiddle around with it
enough to get it to work. Here is the improved getdata.pl file (you
need Perl to run this, as I don't know how to make it into an EXE):

http://home.earthlink.net/~sauroneru/getdata.cfg

I'm not sure how long the link will stay active, but it should work at
least for the next few months.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top