2004-08-10-2308Z


OK, fixed most of the hassles. But for some reason xmms on the client machine won't just play the stream using the URL, I've got to open http://192.168.1.102:8000/mp3.m3u using links, then pass it to xmms when it prompts me. No biggie. Also found out you can rebuild the song list at any time, at least without the -r (randomize) option, and it will update on-the-fly. It might work with -r too, just haven't tested it yet. Well, without further ado, here's my rc.icecast script:

#!/usr/pkg/bin/bash
# icecast streaming startup script
if [ "$1" = "start" ]; then
 HOSTNAME=`hostname`
 HOSTIP=`gethostip -d $HOSTNAME`
 SOURCEPASS=`head -c 8 /dev/urandom | md5sum | head -c 8`
 cat <<EOT >/etc/icecast/icecast.xml
<icecast>
    <limits>
        <clients>100</clients>
        <sources>2</sources>
        <threadpool>5</threadpool>
        <queue-size>102400</queue-size>
        <client-timeout>30</client-timeout>
        <header-timeout>15</header-timeout>
        <source-timeout>10</source-timeout>
    </limits>

<authentication> <!-- Sources log in with username 'source' --> <source-password>$SOURCEPASS</source-password> <!-- Relays log in username 'relay' --> <relay-password>$SOURCEPASS</relay-password>

<!-- Admin logs in with the username given below --> <admin-user>admin</admin-user> <admin-password>$SOURCEPASS</admin-password> </authentication>

<hostname>$HOSTIP</hostname>

<!-- You may have multiple <listener> elements --> <listen-socket> <port>8000</port> <!-- <bind-address>127.0.0.1</bind-address> --> </listen-socket>

<fileserve>1</fileserve>

<paths> <!-- basedir is only used if chroot is enabled --> <basedir>/usr/share/icecast</basedir>

<!-- Note that if <chroot> is turned on below, these paths must both be relative to the new root, not the original root --> <logdir>/usr/var/log/icecast</logdir> <webroot>/usr/share/icecast/web</webroot> <adminroot>/usr/share/icecast/admin</adminroot> </paths>

<logging> <accesslog>access.log</accesslog> <errorlog>error.log</errorlog> <loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error --> </logging>

<security> <chroot>0</chroot> <changeowner> <user>nobody</user> <group>nogroup</group> </changeowner> </security> </icecast> EOT ls -1 /home/nobody/www/music/*/*.mp3 > /home/nobody/www/playlist.txt # the -b doesn't really seem to work, need to add the & anyway icecast -c /etc/icecast/icecast.xml -b & # stream a randomly-ordered list with mountpoint /mp3 ices -P $SOURCEPASS -F /home/nobody/www/playlist.txt -m /mp3 -r -B -t http elif [ "$1" = "restart" ]; then $0 stop $0 start else list="`pidof icecast`"; if [ "$list" ]; then kill $list; fi list="`pidof ices`"; if [ "$list" ]; then kill $list; fi sleep 2 list="`pidof icecast`"; if [ "$list" ]; then kill -KILL $list; fi list="`pidof ices`"; if [ "$list" ]; then kill -KILL $list; fi fi

Back to blog or home page

last updated 2013-01-10 20:27:51. served from tektonic.jcomeau.com