Skip to content

Instantly share code, notes, and snippets.

@gilou
Created August 17, 2018 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gilou/33ffcdb2d345ea1f09642b4399f33f84 to your computer and use it in GitHub Desktop.
Save gilou/33ffcdb2d345ea1f09642b4399f33f84 to your computer and use it in GitHub Desktop.
Liquidsoap script for a simple webradio
socket = "/home/ubuntu/demo/liq.sock"
logfile = "/home/ubuntu/demo/liq.log"
set("log.level", 4)
set("log.file.path", logfile)
# Print log messages to the console,
# can also be done by passing the -v option to liquidsoap.
set("log.stdout", log_stdout)
# Use the telnet server for requests
set("server.socket",true)
set("server.socket.path", socket)
set("server.timeout",-1.)
def mylist(name, ~lists_dir)
playlist(lists_dir ^ name ^ ".m3u",
mode="random",
reload_mode="watch"
)
end
listes_home = "/home/ubuntu/demo/"
mylist = mylist(lists_dir=listes_home)
street = mylist("street")
charts = mylist("charts")
chill = mylist("chill")
party = mylist("party")
matin = rotate(weights = [3, 1], [ chill, charts ])
journee = rotate(weights = [2, 1, 1], [ chill, party, charts ])
soir = rotate(weights = [2, 2, 1, 1], [ party, charts, chill, street ])
nuit = rotate(weights = [ 1, 1, 1, 1 ], [ party, street, charts, chill ])
radio = fallback( [ switch(
[
({ 6h-10h }, matin),
({ 10h-18h }, journee),
({ 18h-24h }, soir),
({ 0h-6h }, nuit)
]),
default
])
cross = smart_crossfade(radio)
output.icecast(
%mp3(bitrate=256),
mount="test",
cross
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment