Solved

Hel with some characters....

Posted on 1999-01-24
4
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Six Sigma Control Plans

636 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