diff --git a/configs/radio.liq b/configs/radio.liq new file mode 100644 index 0000000..45ff700 --- /dev/null +++ b/configs/radio.liq @@ -0,0 +1,52 @@ +#!/usr/bin/liquidsoap +# DO NOT EDIT! WILL BE REPLACED WITH A NEW UPDATE! + +%include "radio.vars.liq" + +def fullpath(p) + string.concat([radio_dir, p]) +end + +def xfade(a, b) + add(normalize = false, + [ sequence([ blank(duration = 2.), + fade.initial(duration = 2., b)]), + fade.final(duration = 2., a)]) +end + +def fallback_alter_title(m) = + [("artist", radio_name), + ("title", string.concat(["No stream. (Playing ", m["artist"], " - ", m["title"], ")"]))] +end + +settings.server.telnet.set(false) +settings.harbor.bind_addrs.set(["0.0.0.0"]) +settings.log.file.set(false) +settings.log.stdout.set(false) + +fallback_song = mksafe(single(fullpath("fallback.mp3"))) +fallback_song = map_metadata(fallback_alter_title, fallback_song) + +live_mixin = input.harbor("adr-live-mixin", port = harbor_port, password = harbor_password) +live_show = input.harbor("adr-live-show", port = harbor_port, password = harbor_password) +live_show = map_metadata(fun (_) -> [("artist", radio_name), ("title", "Live Show")], live_show) + +playlist_random = playlist(fullpath("playlists/all-rand"), + prefix = fullpath("music/"), + mode = "normal", reload_mode = "watch") + +music = audio_to_stereo(playlist_random) + +radio = smooth_add(p = 0.18, normal = music, special = live_mixin) +radio = fallback(track_sensitive = false, + transitions = [xfade, xfade, xfade], + [ blank.strip(max_blank=15., live_show), + blank.strip(max_blank=90., radio), fallback_song]) +radio = normalize(radio) + +output.icecast(%vorbis.cbr(bitrate = 128, samplerate = 44100, channels = 2), + host = icecast_host, port = icecast_port, + password = icecast_password, encoding = "utf-8", + name = radio_name, description = radio_desc, public = true, + mount = icecast_mount, url = radio_url, genre = icecast_genre, + radio) \ No newline at end of file diff --git a/configs/radio.vars.liq b/configs/radio.vars.liq new file mode 100644 index 0000000..2ba4653 --- /dev/null +++ b/configs/radio.vars.liq @@ -0,0 +1,16 @@ +# THIS FILE CAN BE SAFELY CHANGED + +radio_url = "https://radio.arav.top" +radio_name = "Arav's dwelling / Radio" +radio_desc = "Broadcasting from under my desk." + +radio_dir = "/srv/radio" + +harbor_port = 8002 +harbor_password = "" + +icecast_host = "127.0.0.1" +icecast_port = 8000 +icecast_password = "" +icecast_mount = "stream.ogg" +icecast_genre = "Various" \ No newline at end of file