Skip to content

Instantly share code, notes, and snippets.

@skorotkiewicz
Created May 2, 2014 03:43
Show Gist options
  • Save skorotkiewicz/353e4ff38c291b4008d7 to your computer and use it in GitHub Desktop.
Save skorotkiewicz/353e4ff38c291b4008d7 to your computer and use it in GitHub Desktop.
Liquidsoap: AutoDJ for icecast
#!/usr/bin/liquidsoap
set("log.file.path","/tmp/basic-radio.log")
# required speech synthesizer, aptitude install festival
message = "That's it! you listening the radio dubstep is our life, listen to us at school, at home or at a party with friends"
messagesorry = "Sorry for the inconvenience, continuation of the program soon!"
welcome = single("say:"^message)
sorryvoice = single("say:"^messagesorry)
# find /home/music/ -type f -name "*.mp3" > /etc/liquidsoap/music.m3u
radio = playlist("music.m3u")
dubstep = playlist("dubstep.m3u")
#play a random playlist with random music
radio = random(weights = [1, 3, 1],[welcome, radio, dubstep])
#if the music not available
radio = fallback(track_sensitive=false, [radio, sorryvoice])
#if the live broadcast available
full = fallback(track_sensitive=false, [input.http("http://nsa310:8000/live"), radio])
# Stream it out (ogg)
#output.icecast(%vorbis, host = "localhost", port = 8000, password = "<PASSWORD>", mount = "/radio.ogg", full)
# Stream in mp3 ~Low Quality
output.icecast(%mp3(bitrate=32, samplerate=22050, stereo=false), mount="/radio-32.mp3", host="localhost", port=8000, password="<PASSWORD>", mean(full))
# Stream in mp3 ~High Quality
output.icecast(%mp3(bitrate=128), mount="/radio-128.mp3", host="localhost", port=8000, password="<PASSWORD>", full)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment