#!/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.level.set(1) settings.log.file.set(true) settings.log.file.path.set(log_file_path) settings.log.stdout.set(false) enable_replaygain_metadata() fallback_song = mksafe(single(fullpath("fallback.ogg"))) fallback_song = metadata.map(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 = metadata.map(fun (_) -> [("artist", radio_name), ("title", "Live Show")], live_show) playlist_random = playlist(fullpath("playlists/all-rand"), prefix = string.concat(["replaygain:", fullpath("music/")]), mode = "normal", reload_mode = "watch") music = audio_to_stereo(playlist_random) music = replaygain(music) 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(target = -12., threshold = -40., lufs = true, 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)