Necesitaría ayuda con un script que no acabo de entender muy bien como funciona y que me parece que habría que adaptar para poder ejecutarlo en Windows (mi sistema operativo).
El script es el siguiente:
#!/usr/bin/perl
use strict;
#------------------------------------------------------------------------
# This code is open-source as defined by the GPL, 2002
# by Willie Northway - http://www.willienorthway.com/
# http://www.gnu.org/copyleft/gpl.html
# $Id: clam_covers.pl,v 1.8 2003/04/15 14:08:45 willn Exp $
#
# Note: I've noticed some problems in Mac OS X when trying to read
# the pdf from a UFS drive. It reports "Macintosh system error
# (-39)" This is a eofErr - End of File Error. These seem to be readable
# from an HFS+ partition though.
#-------------------------------------------------------------------------
my ($path) = shift;
my (@Data, @Temp);
my ($entry, $file, $line, $query, $grabbed, $data, $datafile, $name);
my ($debug) = 0;
if ($path) { $data = $path; }
else
{
$data = "./data/";
$datafile = 1;
}
if (opendir (DIR, $data))
{
if ($datafile) #read individual data files
{
foreach $entry (sort (readdir (DIR)))
{
$file = $data.$entry;
if (( $entry =~ /^\./ ) || ( $entry =~ /^Desktop D\w/ )) { ; }
elsif ($datafile)
{
if (open (INDATA, "$file"))
{
@Data = <INDATA>;
close (INDATA);
chomp (@Data);
$query = ProcessAlbum( $entry, 1, @Data );
if (!$debug) { `$query`; }
else { print "Q: $query\n\n"; }
}
else { print "Couldn't open data file: $file, $!\n"; }
}
}
}
else #read from CD directory
{
foreach $entry (sort (readdir (DIR)))
{
if (( $entry =~ /^\./ ) || ( $entry =~ /^Desktop D\w/ )) { ; }
elsif (-d $data.$entry)
{
if (opendir (DIR2, $data.$entry))
{
foreach $name (sort (readdir (DIR2)))
{ if ( $name !~ /^\./ ) { push (@Data, "$entry - $name"); } }
close( DIR2 );
}
}
else
{
$entry =~ s/'//;
$entry =~ s/\.aiff$//;
push (@Data, $entry);
}
}
@Temp = split /\//, $data;
while (!$data && $#Temp) { $data = pop (@Temp); }
$data =~ s/^.*\/([^\/]+)\/?$/$1/;
$query = ProcessAlbum( $data, 0, @Data );
if (!$debug) { `$query`; }
else { print "Q: $query\n\n"; }
}
}
else { print "Couldn't open data directory: $!\n"; }
sub Numerically { $a <=> $b; }
sub ProcessAlbum
{
my ($title, $fromfile, @Tracks) = @_;
my ($request, $line_num) = 0;
$title =~ s/ /_/g;
$request = "wget 'http://papercdcase.com/papercdcase.cgi/".
"papercdcase.pdf?artist=$title";
if ( !$fromfile ) { @Tracks = sort Numerically( @Tracks ); }
foreach $line ( @Tracks )
{
$line = CleanName ($line);
$line_num++;
$request .= "&track".$line_num."=$line";
}
$request .= "&template=jewel&size=letter&lang=western".
"&submit.x=0&submit.y=0' --output-document=$title.pdf";
print "\nREQ: $request\n\n";
return $request;
}
sub CleanName
{
my ($line) = @_;
$line =~ s/\+/%2B/g;
$line =~ s/ /+/g;
$line =~ s/&/%26/g;
$line =~ s/'/%27/g;
$line =~ s/#/%23/g;
return $line;
}