All pastes #885303 Raw Edit

Miscellany

public text v1 · immutable
#885303 ·published 2008-01-30 21:14 UTC
rendered paste body
--- arflac-orig 2008-01-30 14:37:04.603825312 -0600
+++ arflac      2008-01-30 15:13:47.203123307 -0600
@@ -21,6 +21,10 @@
 use strict;
 use LWP;
 use Carp;
+use Proc::ParallelLoop;
+
+my $numcores = 2;
+
 my $lwpUserAgent = LWP::UserAgent->new;
 foreach my $flacDir (@ARGV) {
      # Get the list of flac files from the directory
@@ -136,8 +140,8 @@
        my @trackCRCs = ();
        my $FH;
        my ($accuratelyRipped, $notAccuratelyRipped, $notInDatabase) = (0, 0, 0);
-       for (my $trackNo = 0; $trackNo < $trackCount; $trackNo++) {
-
+       #for (my $trackNo = 0; $trackNo < $trackCount; $trackNo++) {
+       { my $trackNo = 0; pardo sub{ $trackNo < $trackCount }, sub { $trackNo++ }, sub {
             # Open a pipe to flac decode
             open($FH, "flac -d -c -f --force-raw-format --totally-silent --endian=little --sign=signed \"$flacDir/$filelist[$trackNo]\" |");
             binmode $FH;
@@ -189,7 +193,8 @@
                                $notAccuratelyRipped++;
                        }
                }
-       }
+       #}
+       }, { "Max_Workers" => $numcores } ; }
        if ($arDiscNotInDb) {
                        print "Disc not present in AccurateRip database.\n";
                        $errLevel = 2;