Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Ripping CDs using cdparanoia

by Tanktalus (Canon)
on Oct 02, 2005 at 03:01 UTC ( #496709=CUFP: print w/replies, xml ) Need Help??

I've had need to rip many audio tracks on my Linux box. I never remember the command (cdparanoia) or its syntax. And running one command before typing in the next one seems silly - retyping "cdparanoia" each time is annoying, and allows the CD to spin down. Meanwhile, I don't really want the tracks to save as their track number, either, which would otherwise make shell scripting trivial: for x in 1 3 8 10; do cdparanoia $x $x.wav; done And, of course, tracks can have errors which could stream past the screen. So, perl to the rescue:

#!/usr/bin/perl use warnings; use strict; my @results; while (@ARGV) { my $track = shift; my $name; if ($track =~ /^(\d+)[=:](.*)$/) { $track = $1; $name = $2; } while (@ARGV and $ARGV[0] !~ /^\d/) { $name .= shift; } $name .= ".wav"; my @cmd = (qw(cdparanoia), $track, $name); print join(" ",@cmd),"\n"; system(@cmd); push @results, sprintf "%-30s - %s (%d)\n", $name, ($? == 0 ? 'SUC +CESS' : 'FAILURE'), $?; } print "\n\n"; print @results;

(Saved as "ripcdaudio") Usage:

$ ripcdaudio 1 song name 2 other song name 5 another song 8 lots of s +ongs
The code will remove those spaces, add the .wav extention, and rip one after another. Then it will print out the filenames and whether they were ripped ok or not at the end where you can see it without having to scroll back through dozens of lines of output.

Replies are listed 'Best First'.
Re: Ripping CDs using cdparanoia
by Skeeve (Vicar) on Oct 02, 2005 at 23:13 UTC
    Cool... But it would be even cooler could you look up freedb for the CD's tracks and use that info for storing.

    But OTOH there is xmcd which can do this. But that's not perl...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://496709]
Approved by planetscape
Front-paged by planetscape
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-03-21 19:03 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (270 votes). Check out past polls.