Chaotic42
Lifer
Edit: Ok, I fixed it. If you're bored, try to figure out what was wrong. It was one character. 😀
Hey guys. I wrote a perl script quite a while ago that ripped/encoded music. I lost the working version, and now I have a partially working version. It asks for the number of tracks, the name of each track, rips, then encodes.
It's supposed to put the track number infront of the name, then add ".mp3". So "Stairway to Heaven" would become "03-Stairway to Heaven.mp3". For some reason, it just makes it "3".
Here's the code (formatting error fixed):
---
#! /usr/bin/perl
print "Enter number of tracks- ";
$tracks=<STDIN>;
chomp $tracks;
print "Enter device name of CD (scd0)- ";
$device=<STDIN>;
if ($device eq ""){
$device="scd0";
}
chomp $device;
for $counter (1 .. $tracks){
print "Enter name of track \#$counter- ";
$track[$counter]=<STDIN>;
chomp $track[$counter];
}
print "Preparing to rip and encode $tracks tracks from device \"/dev/$device\".";
print "Track listings are as follows-\n";
for $counter (1 .. $tracks){
if ($counter < 10){
$track[$counter]="0".$counter."-".$track[$counter];
}
else {
$track[$counter]="0".$counter."-".$track[$counter];
}
print "$track[$counter]\n";
}
for $counter (1 .. $tracks){
system ("cdda2wav -D=0,1,0 -x -t$counter+$counter");
$track[$counter]=$track[$counter]..".mp3";
system ("lame --alt-preset insane audio.wav $track[$counter]");
system ("rm audio.wav");
}
print "Done!";
--
If there is a way to format the post better, let me know. The tabs aren't showing up. Thanks in advance.
Hey guys. I wrote a perl script quite a while ago that ripped/encoded music. I lost the working version, and now I have a partially working version. It asks for the number of tracks, the name of each track, rips, then encodes.
It's supposed to put the track number infront of the name, then add ".mp3". So "Stairway to Heaven" would become "03-Stairway to Heaven.mp3". For some reason, it just makes it "3".
Here's the code (formatting error fixed):
---
#! /usr/bin/perl
print "Enter number of tracks- ";
$tracks=<STDIN>;
chomp $tracks;
print "Enter device name of CD (scd0)- ";
$device=<STDIN>;
if ($device eq ""){
$device="scd0";
}
chomp $device;
for $counter (1 .. $tracks){
print "Enter name of track \#$counter- ";
$track[$counter]=<STDIN>;
chomp $track[$counter];
}
print "Preparing to rip and encode $tracks tracks from device \"/dev/$device\".";
print "Track listings are as follows-\n";
for $counter (1 .. $tracks){
if ($counter < 10){
$track[$counter]="0".$counter."-".$track[$counter];
}
else {
$track[$counter]="0".$counter."-".$track[$counter];
}
print "$track[$counter]\n";
}
for $counter (1 .. $tracks){
system ("cdda2wav -D=0,1,0 -x -t$counter+$counter");
$track[$counter]=$track[$counter]..".mp3";
system ("lame --alt-preset insane audio.wav $track[$counter]");
system ("rm audio.wav");
}
print "Done!";
--
If there is a way to format the post better, let me know. The tabs aren't showing up. Thanks in advance.