Menu

#2 One track skipped on each CD in ver 1.3

open
nobody
None
5
2005-08-19
2005-08-19
No

This is a great script!

The 1st track name is skipped on each CD. I suspect
it's actually the last track that isn't ripped, and
they're each off by one in name.

I am new to Perl, so the debugging is slow. I found
this, which makes the printing of the tracks complete:

diff -Naur autorip_1.3 autorip_huff
--- autorip_1.3 2005-08-18 22:45:43.000000000 -0700
+++ autorip_huff 2005-08-18 22:45:35.000000000 -0700
@@ -404,7 +404,7 @@
print "Title: ",$title,"\n";
print "Artist: ",$artist,"\n";
print "Tracks:\n";
- foreach my $i (1 .. $#track) {
+ foreach my $i (0 .. $#track) { # huff
print "\to $track[$i]";
print " - [$track_artist[$i]]"
if($track_artist[$i] ne $artist);
print "\n";

I'll keep plugging at it, but someone familiar with
Perl & this script will probably be way faster than myself.

Thanks,
Eric Huff

Discussion

  • Anonymous

    Anonymous - 2005-08-19
    • summary: One track skipped on each CD --> One track skipped on each CD in ver 1.3
     
  • Anonymous

    Anonymous - 2005-08-19

    Logged In: YES
    user_id=1066865

    I think this is it, but please correct me if i am wrong.
    This still needs fixed:
    Reporting the correct title
    print "Started encoding $track\n";
    in
    sub enc

    since it prints the next one, not the current one being started.

    Hopefully this helps and I haven't made some sloppy mistake.

    -------------------------------------------
    $ diff -Naur autorip_1.3 autorip_huff
    --- autorip_1.3 2005-08-18 22:45:43.000000000 -0700
    +++ autorip_huff 2005-08-18 23:28:19.000000000 -0700
    @@ -404,7 +404,7 @@
    print "Title: ",$title,"\n";
    print "Artist: ",$artist,"\n";
    print "Tracks:\n";
    - foreach my $i (1 .. $#track) {
    + foreach my $i (0 .. $#track) { # huff
    print "\to $track[$i]";
    print " - [$track_artist[$i]]"
    if($track_artist[$i] ne $artist);
    print "\n";
    @@ -428,7 +428,7 @@
    system ("mkdir -p \'$dir\'");

    # encode
    - my @tracks_pending = ( 1 .. ($#track) );
    + my @tracks_pending = ( 1 .. ($#track + 1) ); # huff
    my @encodes_pending = ();
    my $rip_pid = undef;
    my $enc_pid = undef;
    @@ -448,7 +448,7 @@
    my $track = shift(@encodes_pending);
    my $tmpwav = $tmpdir .
    "/tmp.$$.$track.wav";
    my $mp3file = sprintf
    ("%s/%02d-%s.%s", $dir, $track,
    - escape($track[$track]),
    $encoder_ext);
    + escape($track[$track - 1]),
    $encoder_ext); # huff
    $enc_pid = enc($tmpwav, $mp3file,
    $track, $track[$track],
    $track_artist[$track], $title);
    }

     
  • Joshua Geller

    Joshua Geller - 2006-05-10

    Logged In: YES
    user_id=406504

    You were super close Eric. The last problem is the encoder
    adds the track+1's tag to the file. Here's a diff that works:
    --- autorip-orig 2006-05-10 15:16:28.000000000 -0400
    +++ autorip 2006-05-10 15:03:31.000000000 -0400
    @@ -404,7 +404,7 @@
    print "Title: ",$title,"\n";
    print "Artist: ",$artist,"\n";
    print "Tracks:\n";
    - foreach my $i (1 .. $#track) {
    + foreach my $i (0 .. $#track) {
    print "\to $track[$i]";
    print " - [$track_artist[$i]]"
    if($track_artist[$i] ne $artist);
    print "\n";
    @@ -428,7 +428,7 @@
    system ("mkdir -p \'$dir\'");

    # encode
    - my @tracks_pending = ( 1 .. ($#track) );
    + my @tracks_pending = ( 1 .. ($#track + 1) );
    my @encodes_pending = ();
    my $rip_pid = undef;
    my $enc_pid = undef;
    @@ -447,10 +447,10 @@
    {
    my $track = shift(@encodes_pending);
    my $tmpwav = $tmpdir .
    "/tmp.$$.$track.wav";
    - my $mp3file = sprintf
    ("%s/%02d-%s.%s", $dir, $track,
    - escape($track[$track]),
    $encoder_ext);
    - $enc_pid = enc($tmpwav, $mp3file,
    $track, $track[$track],
    - $track_artist[$track], $title);
    + my $mp3file = sprintf ("%s/%02d -
    %s.%s", $dir, $track,
    + escape($track[$track - 1]),
    $encoder_ext);
    + $enc_pid = enc($tmpwav, $mp3file,
    $track, $track[$track - 1],
    + $track_artist[$track - 1],
    $title);
    }
    last if ((!defined($enc_pid)) &&
    (!defined($rip_pid)));
    my $pid = wait();

     
  • Joshua Geller

    Joshua Geller - 2006-05-10

    Logged In: YES
    user_id=406504

    Formatting got messed up. Let me try again:
    --- autorip-orig 2006-05-10 15:16:28.000000000 -0400
    +++ autorip 2006-05-10 15:03:31.000000000 -0400
    @@ -404,7 +404,7 @@
    print "Title: ",$title,"\n";
    print "Artist: ",$artist,"\n";
    print "Tracks:\n";
    - foreach my $i (1 .. $#track) {
    + foreach my $i (0 .. $#track) {
    print "\to $track[$i]";
    print " - [$track_artist[$i]]"
    if($track_artist[$i] ne $artist);
    print "\n";
    @@ -428,7 +428,7 @@
    system ("mkdir -p \'$dir\'");

    # encode
    - my @tracks_pending = ( 1 .. ($#track) );
    + my @tracks_pending = ( 1 .. ($#track + 1) );
    my @encodes_pending = ();
    my $rip_pid = undef;
    my $enc_pid = undef;
    @@ -447,10 +447,10 @@
    {
    my $track = shift(@encodes_pending);
    my $tmpwav = $tmpdir .
    "/tmp.$$.$track.wav";
    - my $mp3file = sprintf
    ("%s/%02d-%s.%s", $dir, $track,
    - escape($track[$track]),
    $encoder_ext);
    - $enc_pid = enc($tmpwav, $mp3file,
    $track, $track[$track],
    - $track_artist[$track], $title);
    + my $mp3file = sprintf ("%s/%02d -
    %s.%s", $dir, $track,
    + escape($track[$track - 1]),
    $encoder_ext);
    + $enc_pid = enc($tmpwav, $mp3file,
    $track, $track[$track - 1],
    + $track_artist[$track - 1],
    $title);
    }
    last if ((!defined($enc_pid)) &&
    (!defined($rip_pid)));
    my $pid = wait();

     

Log in to post a comment.

MongoDB Logo MongoDB