Here's something I wrote in perl to encode mp3's ripped from a cd. It's not elegant, but it works.
---- Cut here----
#!/usr/bin/perl -w
# this is the SCSI device id $cd_device="1,3,0"; $encoder_options="-S -m s -q 0 --vbr-new -V 0 -b 192 -B 320 -f -k";
mkdir "riptemp"; chdir "riptemp";
system ("/usr/bin/cdda2wav -D $cd_device -B -L");
open (CDINDEX, "audio.cdindex") || die "Can't open file: audio.cdindex \n"; while (<CDINDEX>) { if (/Title>(.*)</) { $album=$1; } if (/Artist>(.*)</) { $artist=$1; } if (/Num="(\d+)">/) { $count=$1; } if (/Name>(.*)</) { $song[$count]=$1; }
} close CDINDEX;
@wavfiles=`ls *.wav`; chomp(@wavfiles);
@mp3files=@wavfiles;
for (0..$#mp3files) { $mp3files[$_]=~ s/wav/mp3/; }
for (0..$#wavfiles) { my $track; $track=$_ + 1; system(qq{/usr/local/bin/lame $encoder_options --tl "$album" --ta "$artist" --tt "$song[$track]" --tn $track $wavfiles[$_] $mp3files[$_]}); }
mkdir "../$artist"; mkdir "../$artist/$album";
for (0..$#mp3files) { my $track; $track=$_ +1; system(qq{ mv $mp3files[$_] "../$artist/$album/$artist - $album - $song[$track].mp3"}); }
system ("rm -f audio*"); chdir ".."; rmdir "riptemp";
---and here :-)-----