RE: [PHP] system()

From: Date: Mon, 19 Feb 2001 20:00:57 +0000
Subject: RE: [PHP] system()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40589@lists.php.net to get a copy of this message
i am not positive about this, but you could try making the amp process a background process by adding a " &" to the end of the command line (at least if you're using *nix) > -----Original Message----- > From: Ashley M. Kirchner [mailto:ashley@pcraft.com] > Sent: Monday, February 19, 2001 00:40 > To: PHP-General List > Subject: [PHP] system() > > > > 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. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#40589) next »