Solved

Hel with some characters....

Posted on 1999-01-24
4
150 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
Comment Utility
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
Comment Utility
Thanks... Mark the question as answerd.
0
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
Comment Utility
perldoc -f system
0
 

Author Comment

by:n94magho
Comment Utility
Thanks....
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now