You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.9 KiB
81 lines
1.9 KiB
#!/usr/bin/liquidsoap
|
|
|
|
settings.harbor.bind_addrs.set(["0.0.0.0"])
|
|
enable_replaygain_metadata()
|
|
|
|
def print_meta(data)
|
|
a = data["artist"]
|
|
t = data["title"]
|
|
|
|
message = json()
|
|
message.add("action", "metadataChange");
|
|
message.add("data", { artist = a, title = t})
|
|
|
|
http.post(data=message.stringify(), headers=[("Content-Type", "application/json; charset=UTF-8")], "metadata:4000")
|
|
()
|
|
end
|
|
|
|
def live_start(_)
|
|
message = json()
|
|
message.add("action", "liveStarted");
|
|
http.post(data=message.stringify(), headers=[("Content-Type", "application/json; charset=UTF-8")], "metadata:4000")
|
|
()
|
|
end
|
|
|
|
def live_end()
|
|
message = json()
|
|
message.add("action", "liveEnded");
|
|
http.post(data=message.stringify(), headers=[("Content-Type", "application/json; charset=UTF-8")], "metadata:4000")
|
|
()
|
|
end
|
|
|
|
security = single("/music/jingle.mp3")
|
|
|
|
arctica_music = playlist("/music/arctica/music")
|
|
arctica_jingles = playlist("/music/arctica/jingles")
|
|
arctica = replaygain(rotate(weights=[5, 1], [arctica_music, arctica_jingles]))
|
|
|
|
jellyfish_migrations_music = playlist("/music/main_air")
|
|
jellyfish_migrations = replaygain(jellyfish_migrations_music)
|
|
|
|
general_stream = normalize(switch([
|
|
({13h-15h}, arctica),
|
|
({true}, jellyfish_migrations)
|
|
]))
|
|
|
|
live_stream = input.harbor(
|
|
"iceberg-live",
|
|
port=6000,
|
|
user="djiceberg",
|
|
password="hackme",
|
|
on_connect=live_start,
|
|
on_disconnect=live_end
|
|
)
|
|
|
|
radio = fallback(track_sensitive = false, [live_stream, general_stream, security])
|
|
radio.on_metadata(print_meta)
|
|
|
|
output.icecast(%mp3,
|
|
host = "icecast",
|
|
port = 8000,
|
|
password = "hackme",
|
|
mount = "iceberg.ogg",
|
|
radio)
|
|
|
|
output.file.hls(
|
|
id="output.hls",
|
|
playlist="livestream.m3u8",
|
|
segment_duration=2.0,
|
|
segments=5,
|
|
segments_overhead=5,
|
|
persist_at="state.config",
|
|
temp_dir="/hls",
|
|
"/hls",
|
|
[
|
|
("hi", %mp3(bitrate=320)),
|
|
("mid", %mp3(bitrate=160)),
|
|
("low", %mp3(bitrate=96))
|
|
],
|
|
radio
|
|
)
|