Skip to content

Instantly share code, notes, and snippets.

@furriest
Forked from gilou/test.liq
Created November 13, 2023 09:51
Show Gist options
  • Save furriest/51bd1d52e8461e34ce973fd3cd9895bd to your computer and use it in GitHub Desktop.
Save furriest/51bd1d52e8461e34ce973fd3cd9895bd 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