Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Creating a Complete Wrapper for a Compiled Program

by Vautrin (Hermit)
on Mar 30, 2004 at 19:06 UTC ( #341057=perlquestion: print w/replies, xml ) Need Help??

Vautrin has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to create a Perl script to take a CD, and automatically rip it, encode it, organize the files, and save the data in a database so that I can tell the script to DJ for me. For instance, I want to be able to tell the program to [;ay x hours of music and the percentage of each genre to include. Furthermore, I want it to use Tk, so that it looks cool.

I am running into problems with cdparanoia. When cdparanoia runs, it outputs a very detailed status message to the screen. Is there a way to capture what cdparanoia is sending to the terminal, so that I can read in the data (i.e. the progress), and then use that to update a Tk based status bar?

I thought about redirecting the output of cdparanoia via a pipe to a perl script or something of that nature, but I was wondering if anyone knows of a more elegant way. Also, I already checked CPAN, and the only cdparanoia module I found, POE::Component::CD::Rip doesn't meet my needs.

Many thanks in advance,

Vautrin


Want to support the EFF and FSF by buying cool stuff? Click here.
  • Comment on Creating a Complete Wrapper for a Compiled Program

Replies are listed 'Best First'.
Re: Creating a Complete Wrapper for a Compiled Program
by ccn (Vicar) on Mar 30, 2004 at 19:23 UTC
    You can use IPC::Open2 to control stdin, stdout of an external program, or use IPC::Open3 to control stderr also.
Re: Creating a Complete Wrapper for a Compiled Program
by saintmike (Vicar) on Mar 30, 2004 at 20:20 UTC
    As explained here, using POE along with Tk is a good idea. As for running cdparanoia and dealing with its output, this looks like a job for POE::Wheel::Run.

    -- saintmike

Re: Creating a Complete Wrapper for a Compiled Program
by matija (Priest) on Mar 30, 2004 at 19:24 UTC
    Well, you could open cdparanoia as a pipe:
    open(CD,"cdparanoia .... |") || die "could not open pipe to cdparanoia +";
    Don't forget to turn off the buffering on the filehandle.
Re: Creating a Complete Wrapper for a Compiled Program
by Three (Pilgrim) on Mar 31, 2004 at 20:41 UTC
    Why dont you try a diffrent tact on it.
    Rip all your cd's to mp3 then write a perl program to parse the id3 tags inside the mp3's.
    Here is a link with some modules that might help.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://341057]
Approved by arden
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-01-24 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?