This quick and dirty wrapper runs netstat to see if
there are any TCP connections to the icecast server. If
so, it plays as normal; if not it a dummy mp3. I'm
using 15 seconds of silence, but if you could use
elevator music, or whatever your sense of humour suggests.
This does add some latency to the connection process;
the dummy mp3 must finish before the next song on the
playlist can start playing.
The main reason I wrote this was to save power/noise -
though playing the dummy mp3 saves no processor time
(globecomice does no transcoding, so it doesn't really
use much processor time anyway), it eliminates accesses
to the disk. The dummy mp3 (and the rest of the jukebox
scripts) easily fit into the disk cache, and there are
no writes to the database when the playlist is not
progressing. Consequently, the server can spin down its
drives, saving power (and lengthening the lifespan of
YMMV - other processes on the server may write to (and
hence spin up) the drive, and disk caching is
notoriously OS dependent. Depending on your kernel
version, build-time settings, filesystem, free RAM,
etc., this may or may not work.
Copy howmanyshoutcasts.sh and dontplaywrapper.phpsh to
your jukebox directory (the same directory as
globecomice), and chmod +x them.
Customise howmanyshoutcasts.sh to the port your
shoutcast server is on.
Customise dontplaywrapper.phpsh with the directory
jukebox is installed in
Copy a 'silence.mp3' into your jukebox directory
Recompile globecomice to use 'dontplaywrapper.phpsh'
instead of 'getnextmp3.pl', and install this new
version in your jukebox directory.