Skip to content

Instantly share code, notes, and snippets.

@mabe-at
Created October 18, 2016 09:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mabe-at/df2c08176abb3a914da37370963b3959 to your computer and use it in GitHub Desktop.
Save mabe-at/df2c08176abb3a914da37370963b3959 to your computer and use it in GitHub Desktop.
Automatic switch to live-stream with liquidsoap
#!/usr/bin/liquidsoap
# Music
myplaylist = playlist("<path_to_playlist>/playlist.m3u")
# If something goes wrong, we'll play this
security = single("<path_to_fallback>/fallback-loop.mp3")
# optional speech generator
livesoon = single("say:We are live soon!")
# Build feed by rotating playlist and speech
radio = rotate(weights=[1,1],[ myplaylist, livesoon ])
# amplify to match live volume level
radio = amplify(0.1,override="replay_gain",radio)
# And finally build stream, which switches to live stream, if there is any signal
finalradio = fallback(track_sensitive = false, [input.http("<url_to_icecast_live>"), radio, security])
# Stream this to icecast
output.icecast(%mp3(bitrate=96),
host = "<icecast_server>",
port = <port>,
password = "<source_password>",
mount = "<mount_point>",
url = "<metadata_url>",
name = "<metadata_name>",
description = "<metadata_description>",
genre = "<metadata_genre>",
finalradio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment