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

Hello Monks...

In the last couple of weeks, in my spare time, I wrote an MP3 player/organizer with a Curses interface. I chose Curses because I wanted to get it up and running, and I'm very familiar with Curses.

The layout is something like this:

PLAYER AREA---------------------PLAYLIST --------------------------------TAGS/INFO LIBRARY-------------------------LIBRARY OPTIONS --------------HELP AREA--------------------------

My tags are stored in a MySQL database.

Anyway, you pick songs from the library, hit ENTER, and it drops them into the playlist. When you want to start up the playlist, you hit ENTER on a song. From then on you have various controls like skipping, pausing, prev/next, etc. Playlists can be saved, loaded, and exported to .m3u files.

I'm happy with it, but there's always room for improvement, right?

Here's where my question comes in...

I currently use the MP3::Daemon to play the songs. I've experimented with MPG123, but had trouble with it because it seems that you always have to "poll it" with a loop.

What I would like to do is be able to play songs, and have the program, via a fork or whatever, update the player area with song/artist/time info, while the user can still pick songs in the library, edit tags, etc.

I haven't figured out the best way to do it. I've played around with forking processes, but had difficulty killing it properly when the user hit PAUSE, etc.

Thanks for any help.

Dale

20041101 Edit by ysth: code tags around layout

Replies are listed 'Best First'.
Re: Tips for my Perl/Curses MP3 player/organizer
by saintmike (Vicar) on Oct 29, 2004 at 07:21 UTC
    Take a look at rateplay. It faces the same problem: How to respond to user input and maintain the GUI while a song is playing? Instead of curses, it uses Gtk. To keep both the GUI happy and play the song, it uses cooperative multitasking with POE. There's more info on the internals in this article, but only in German.
      Thanks saintmike...I'll check it out. Dale