system()

From: Date: Mon, 19 Feb 2001 08:39:32 +0000
Subject: system()
Groups: php.general 
Request: Send a blank email to php-general+get-40546@lists.php.net to get a copy of this message
While doing a test run on an idea I have, I tried running the system() command on an audio application: <? system('amp -p song_one.mp3') ?> ...and found out that it works when I load the file up in a browser - I get sound coming out from the physical web server's audio port. Don't worry, this was the expected behavior, and also what I wanted to happen. However, as the manual page says, system() will hang till the command is done running. I can hit the browser's Stop button, however the actual application is still running - and won't stop till the file is done playing I assume (or will it quit based on the webserver's time out value?) I suppose I can create a button on the same page that executes something like system('killall -KILL amp'); and be done with it. Haven't tried that yet. But, if I'm still crazy tomorrow and plan on continuing with this project, how should this be done properly? Obviously, 'holding' the browser while the program runs isn't the right way to do it. And I need a way to stop the audio somehow. The actual project looks something like this: The server has a few directories filled with mp3 files. I'd like to build a script that would dive into one of those directories (depending on the user selection), and present a list of all the songs, with a check box. The user can then select the ones s/he would like to hear and click a Play button and enjoy. The amount of selections can be anything, from one song, to all (should they want to sit there for 15 hours). However, when they click Play, I want the same page to be reloaded again, with nothing selected, and their (previous) selection to start playing in the background. If they want to change their selection, they can go ahead and pick other songs, and click Play again - THIS is where the previous instance of the 'amp' program should be killed, and a new one started, with the new play list queued. And of course, it should also have a Stop button on the page somewhere. A few notes on the amp program (for those that don't know it): I _CAN_ run several instances of it, and they will all output audio simultaneously through the port (unlike Windows which will tell you the audio device is busy). So, if I start it once with song_one.mp3 playing, and a second time with song_two.mp3 playing, you will hear both songs at the same time. (for that matter, I can run some 6 or 7 instances of the thing before the CPU starts to hiccup). It also doesn't exit till the file is done playing (I believe all players do this). I'm not asking for someone to actually build this for me, no. But I would be very grateful for some pointers, what can I do, and what I should not do, and what to avoid all together. It's something for my household to use, so they can listen to music through a simple interface, as opposed to having to log into the server and figuring out how/what to do through the shell, or X-Win interface. Am I crazy? -- H | Hi, I'm currently out of my mind. Please leave a message. BEEEEP! |____________________________________________________________________ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130 Director of Internet Operations / SysAdmin . 800.441.3873 x130 Photo Craft Laboratories, Inc. . eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave, #6 .................. . . . . Boulder, CO 80303, U.S.A.

« previous php.general (#40546) next »