scripting problem

Christopher Twigg cdtwigg at u.washington.edu
Thu Sep 16 08:23:17 PDT 1999


My bad; that should be:

#!/usr/bin/perl
 
# Play each song listed on the command line:
foreach $song ( @ARGV )
{
	# You'll probably want to include the full paths
	# to these programs, also:
 	system( "xaudio", "-output=wav:/burn/dl-gh.wav", $song );
	#                                                ^^^^^ oops
 	system( "auplay", "-vol", "70", "/burn/dl-gh.wav" );
 	# Assuming auplay waits until completion:
 	unlink("/burn/dl-gh.wav");
}


Christopher Twigg
cdtwigg at u.washington.edu

On Thu, 16 Sep 1999, Christopher Twigg wrote:

> I honestly don't think Perl would be _that_ bad of an idea.  If you were
> going to play 10 songs at a time, the Perl interpreter would take a fairly
> negligable amount of time.  What you could do is something like:
> 
> #!/usr/bin/perl
> 
> # Play each song listed on the command line:
> foreach $song ( @ARGV )
> {
> 	system( "xaudio", "-output=wav:/burn/dl-gh.wav" );
> 	system( "auplay", "-vol", "70", "/burn/dl-gh.wav" );
> 	# Assuming auplay waits until completion:
> 	unlink("/burn/dl-gh.wav");
> }
> 
> If you could emulate the argument sequence of one of the prominent Linux
> MP3 players, you could even use a shell that someone else has written and
> just drop your "player" in as the external program it runs for each MP3.
> 
> If you're thinking about doing CGI programming, note that Perl is a lot
> better than shell scripting for that, especially in Taint mode.
> 
> Christopher Twigg
> cdtwigg at u.washington.edu
> 
> On Thu, 16 Sep 1999, R. David Whitlock wrote:
> 
> > OK, so here's one for you shell script gods:
> > 
> > I need to figure out some nice way to chain together some commands, and so
> > for efficiency, it's probably better to do this in shell since I read
> > somewhere that writing it in perl would make it take longer to execute
> > since it has to start up the perl interpreter and all that.  But I haven't
> > really done any serious shell scripting, and I'd like to expand this
> > eventually into something more elegant, like perhaps a GUI or a cgi script
> > or something, so I'd like your comments and opinions. 
> > 
> > ($flame-suit = "on")
> > 
> > I have MP3's on my campus ethernet box at home.  I work on an xterm with a
> > sound card sorta, that can play wav files.  To get the files to play, I
> > have to use a decoder to zip the files out to a .wav file, and then run
> > something like 'auplay' to stream the wav files over to the xterm, where
> > they play in admittedly less than stellar quality.  But that's not the
> > point.  They play, and its in all rather nice...
> > 
> > ------------------------------------------------------------
> > [david at pandora]$ xaudio -output=wav:/burn/dl-gh.wav
> > /mnt/cdrom2/Deelite-Groove\ is\ in\ the\ Heart.mp3  <--one line
> > 
> > XAUDIO: stream type = MPEG 1, layer III, 128 kbps, 44100 hz, joint-stereo
> > (this is the output from xaudio, finishes in like 10 seconds)
> > 
> > [david at pandora]$ auplay -vol 70 dl-gh.wav  <---second line
> > --------------------------------------------------------------
> > 
> > So I want to figure out some nifty shell script where I just run a single
> > command and the box extracts out the wav and streams it across.  BUT you
> > notice this has created a large (~40 megs maybe) .wav file, something I
> > don't really want to leave laying around taking up space, so I need to
> > remove it sometime after I'm done.  In addition, you have the nasty break
> > inbetween songs where it takes 10 seconds to decode the next you want to
> > use, and then you type in a long command to play the file.
> > 
> > Is there some wonderful elegant way to do this?  I can deal with the
> > pause, maybe just do 3 songs at a time or something with "station breaks"
> > in between.  But the command-typing is horrid, and without some better
> > idea of how to do shell programming, this is not going anywhere.
> > 
> > Any of you scroungy hackers want to take a bash? (no pun intended)  Got
> > any ideas on implementation?  Can you just clue me in on how to fiddle
> > with the shell stuff?  I'd appreciate any tips so I can learn to do this.
> > 
> > Later, (and thanks for reading a long post...)
> >  David
> > 
> > 
> > 
> > 
> > 
> 
> 



More information about the Linux mailing list