[xiph-cvs] cvs commit: ices/contrib run_ices template.xml

Michael Smith msmith at xiph.org
Fri Sep 21 05:24:02 PDT 2001



msmith      01/09/21 05:24:02

  Added:       contrib  run_ices template.xml
  Log:
  Add a script contributed by  Ciaran Anscomb to automate some stuff.

Revision  Changes    Path
1.1                  ices/contrib/run_ices

Index: run_ices
===================================================================
#!/bin/sh

# script to help automate generation of config file and startup of ices2,
# mostly useful for people trying to do things like run ices2 from cron.
# use with template.xml.

# contributed by Ciaran Anscomb <ciarana at rd.bbc.co.uk>
# distributed under GPL, see LICENSE

amplerate=44100
channels=2
bitrate=64000
module=sun
server=192.168.200.5
port=8001
password=changeme

LD_LIBRARY_PATH=/usr/local/ogg/lib
export LD_LIBRARY_PATH
PATH=/usr/local/ogg/bin:/usr/ucb:/usr/bin:/usr/etc
cd /usr/local/ogg/bin

while [ "x$1" != "x" ]; do
        opt=$1
        shift
        case $opt in
        -o) outfile=$1; shift; ;;
        -t) time=$1; shift; ;;
        -sr) samplerate=$1; shift; ;;
        -c) channels=$1; shift; ;;
        -b) bitrate=$1; shift; ;;
        -S) server=$1; shift; ;;
        -P) port=$1; shift; ;;
        -p) password=$1; shift; ;;
        -m) module=$1; shift; ;;
        *) mount=$opt; ;;
        esac
done

ed "s#@MODULE@#$module#g;s#@SAMPLERATE@#$samplerate#g;s#@CHANNELS@#$channels#g;s#@SERVER@#$server#g;s#@PORT@#$port#g;s#@PASSWORD@#$password#g;s#@MOUNT@#$mount#g;s#@BITRATE@#$bitrate#g" < template.xml > live.xml

ices live.xml &
icespid=$!
if [ "x$outfile" != "x" ]; then
        sleep 1
        wget -q http://$server:$port$mount -O $outfile &
        wgetpid=$!
fi
if [ "x$time" != "x" ]; then
        sleep $time
        if [ "x$wgetpid" != "x" ]; then
                kill -INT $wgetpid
        fi
        kill -INT $icespid
else
        wait $icespid
fi

1.1                  ices/contrib/template.xml

Index: template.xml
===================================================================
<?xml version="1.0"?>
<ices>

        <background>0</background>
        <logpath>/tmp</logpath>
        <logfile>ices.log</logfile>
        <loglevel>1</loglevel>

        <stream>
                <metadata>
                        <name>Radio X</name>
                        <genre>Nothing</genre>
                        <description>Blah</description>
                </metadata>
                <input>
                        <module>@MODULE@</module>
                        <param name="rate">@SAMPLERATE@</param>
                        <param name="channels">@CHANNELS@</param>
                        <param name="device">/dev/audio</param>
                        <param name="metadata">0</param>
                </input>
                <instance>
                        <hostname>@SERVER@</hostname>
                        <port>@PORT@</port>
                        <password>@PASSWORD@</password>
                        <mount>@MOUNT@</mount>
                        <encode>  
                                <bitrate>@BITRATE@</bitrate>
                                <samplerate>@SAMPLERATE@</samplerate>
                                <channels>@CHANNELS@</channels>
                        </encode>
                </instance>
        </stream>
</ices>

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list