connects to a remote shoutcast server and transcodes to aac and mp3 and rebroadcasts to multiple shoutcast servers
shoutast based sources (djs) connect, switching from the remote source to the live source immediately, and back on disconnect
if the remote source fails, play a local file

put the following code into a file.liq and run



#!/usr/bin/liquidsoap

# set full path to logfile
set("log.file.path","/var/log/liquidsoap/radiostation.log")

# enable daemon mode
set("init.daemon",true)

# change to run under a custom user/group
set("init.daemon.change_user",true)
set("init.daemon.change_user.group","username")
set("init.daemon.change_user.user","groupname")

# do not create a pid file
set("init.daemon.pidfile",false)

# ip to listen on for djs and sources
set("harbor.bind_addr","127.0.0.1")

# remote source to be transcoded
url = "http://www.remotehost.com:8000"
relay = mksafe(input.http(url))

# port and pass for djs
live = input.harbor("/",port=8000,password="djpassword")

# local file
emergency = single("/path/to/some/lastresort.mp3")

# fallback function
radio = fallback(track_sensitive=false,[live,relay,emergency])

# output to shoutcast servers
output.shoutcast(%mp3(bitrate=256,samplerate=44100,stereo=true),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8000,password = "changeme",radio)
output.shoutcast(%mp3(bitrate=128,samplerate=44100,stereo=true),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8010,password = "changeme",radio)
output.shoutcast(%mp3(bitrate=64,samplerate=44100,stereo=true),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8020,password = "changeme",radio)
output.shoutcast(%mp3(bitrate=24,samplerate=22050,stereo=false),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8030,password = "changeme",radio)
output.shoutcast(%aac(bitrate=256),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8000,password = "changeme",radio)
output.shoutcast(%aac(bitrate=128),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8010,password = "changeme",radio)
output.shoutcast(%aac(bitrate=64),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8020,password = "changeme",radio)
output.shoutcast(%aac(bitrate=24),name="Radio Station",genre="Genre",host="127.0.0.1",port = 8030,password = "changeme",radio)