diotalevi++ for introducing me to some wonderful sounding music.
When you run this, it displays nothing unless you change the value of the DEBUG constant to a true value. Even after changing the DEBUG value, it looks like the program is stuck in an endless loop. In the download_files subroutine where you have the file exist check of $file, I have added an else clause to print that it's downloading like this:
if (-e $file) {
print "SKIP\n" if DEBUG;
next;
} else {
print "downloading...\n" if DEBUG;
}
Also, I found two problems with your code.
1) You define the $SaveExt variable with this code:
our $SaveExt = '.wma';
Then in the download_files subroutine, you use the value like this:
my $file = "$directory$base_file.$SaveExt";
To keep the filename from looking like 081902..wma, change this line to:
my $file = "$directory$base_file$SaveExt";
2) I looked at the javascript files that this script parses and I found a problem with your regex. You have a $ at the end that should not be there.
Change:
our $SaveType = qr/http:\/\/.+?\.asx$/;
to:
our $SaveType = qr/http:\/\/.+?\.asx/;
and it appears to work as expected.
Update: You fixed your source as I was typing this up. :) |