in reply to Re: Dynamically altering Tk buttons
in thread Dynamically altering Tk buttons
Yup, I found that method myself, after some digging.
How I'm detecting the end of playback is a little sneaky. I'm spawning the CLI MP3 player application like this:
$cmd = sprintf($opts{playercmd}, ($listbox->getRow($i))[0]); $player_pid = open($PLAYER, "|$cmd");
This gets me a blocking open on the player, so that I don't ever get two tracks playing at once, and a child PID back. But, the child player doesn't terminate on exit. So then I poll /proc/pid/status every 50ms in my non-Tk event loop, and wait for the status to change to 'zombie', at which point I know playback has finished. Then I can close the player handle, do any necessary processing, and advance to the next track. The 50ms response time is too short for the listener to notice, but slow enough in system terms that the task load from the polling is down in the noise.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Dynamically altering Tk buttons
by zentara (Cardinal) on Jan 04, 2010 at 17:25 UTC | |
by Llew_Llaw_Gyffes (Scribe) on Jan 04, 2010 at 19:27 UTC | |
by zentara (Cardinal) on Jan 05, 2010 at 12:02 UTC | |
by Llew_Llaw_Gyffes (Scribe) on Jan 05, 2010 at 19:52 UTC | |
by zentara (Cardinal) on Jan 06, 2010 at 11:21 UTC |