Solved

Hel with some characters....

Posted on 1999-01-24
4
155 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

19 Experts available now in Live!

Get 1:1 Help Now