Solved

Hel with some characters....

Posted on 1999-01-24
4
157 Views
Last Modified: 2010-05-18
I use this script to rip music and make mp3:

I have some problems. It doesn't work If I try to ripp a sont that contains a ' and something like that. For exampel
I'd be brooken. (It says:
sh: unexpected EOF while looking for `''
)
When it tries to run cdparanoia.
cdparanoia works if I do a:
cdparanoia -d /dev/sr0 1 "I'd be brooken.wav"
How can I get the script to work with such characters??
And what other characters can be problematic and how can I fix this?

---------------- cut ------------------------------
#!/usr/bin/perl

$ripper="/usr/local/bin/cdparanoia";
$encoder="/usr/local/bin/bladeenc";
$bitrate=256;
$device="/dev/sr0";

if($ARGV[0] eq "")
{
    print "USAGE: ripper a b, where a is the firs tracks on the CD that you w
ould like ripped and b is the last.\n";
    exit 0;
}

system("cda on") == 0 || die "cda on failed: $?";
open(FIL, , "cda toc |") || die "Unable to get contents from cda";
$_ = <FIL>;
chomp;
die "Unknown format: $_" unless m/^Disc ID: /;
$artist = <FIL>;
chomp($artist);
$artist =~ s/\s*\/.*$//;
die "Unknown format: no artist" if $artist eq "";
print "Artist: $artist\n";
my($i) = 1;
while(<FIL>)
{
    s/^\s+|\s+$//g;
    next if $_ eq '';
    last if m/^Total Time/;
    m/^\d+\s+[\d:]+\s+(.*)$/;
    $track[$i++] = $1;
}
close(FIL);

system("cda off");
system("clear");

$a=$ARGV[0];
$b=$ARGV[1];
foreach( @track ){ tr/*//d }
foreach( @track ){ tr/?//d }

for($i = $a; $a <= $b; $a ++) {
    if ($a < 10)
    {
      `$ripper -d $device $a '0$a - $track[$a].wav'`;
      system ("$encoder -$bitrate -QUIT -CRC -DELETE '0$a - $track[$a].wav' '$i - $track[$a].mp3'");
     }
    else
    {      
      `$ripper -d $device $a '$a - $track[$a].wav'`;
      system ("$encoder -$bitrate -QUIT -CRC -DELETE '$a - $track[$a].wav' '$i - $track[$a].mp3'");
    }
}


exit 0;


0
Comment
Question by:n94magho
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1210301
system($ripper,'-d',$device,$a,"0$a - $track[$a].wav");
system ($encoder,"-$bitrate",'-QUIT','-CRC','-DELETE',"0$a - $track[$a].wav","$i - $track[$a].mp3");
0
 

Author Comment

by:n94magho
ID: 1210302
Thanks... Mark the question as answerd.
0
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
ID: 1210303
perldoc -f system
0
 

Author Comment

by:n94magho
ID: 1210304
Thanks....
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question