Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hel with some characters....

Posted on 1999-01-24
4
Medium Priority
?
163 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 400 total points
ID: 1210303
perldoc -f system
0
 

Author Comment

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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

721 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