So I have an instance of Liquidsoap, with a harbor input on port 8080.
What I'd like to have happen is whenever someone connects to /live, the stream is recorded and saved on a server.
This works fine, however, if for example I am recording, then disconnect and allow the playlist to kick in, when I try and stream again, it creates a new file, but starts writing to both the new file and the previous recording.
It is basically over writing the first file. The only way this doesn't happen, is if liquidsoap has a restart between the 2 broadcasts.
Here is a copy of my liq file:
#!/usr/bin/liquidsoap
# Don't create a pidfile
#set("init.daemon.pidfile",false)
# Create Log File
set("log.file.path","/tmp/ls-log.log")
set("log.file.perms",755)
set("log.unix_timestamps",true)
# DJ or Metadata IP Address
set("harbor.bind_addr","0.0.0.0")
# Port / Pass for Live DJs
live = input.harbor(id="live",port=8080,password="xxxxxx", "live")
# Find /home/music/ -type f -name "*.mp3" > /etc/liquidsoap/music.m3u
# Path to playlist file which contains a list of local mp3's (/home/user/mp3/song.mp3)
playlist = playlist("./home/taskone/stream/playlists/dubstep/playlist.txt")
# Path to backup track if other streams fail
backup = single("./home/taskone/stream/backups/dubstep/Task One - Studio Sessions.mp3")
# Do not monitor for radio silence and also specify the expected play order
radio = fallback(track_sensitive=false,[live, playlist, backup])
# Function to manually change song title
title = insert_metadata(radio)
insert = fst(title)
radio = snd(title)
def set_meta(~protocol,~data,~headers,uri) =
title = url.split(uri)
meta = metadata.export(snd(title))
show_title = meta["title"]
ret = if meta != [] then insert(meta) "Title Updated - #{show_title}" else "No metadata to add!" end
http_response(protocol=protocol,code=200,headers=[("Content-Type","text/html")],data="<html><body><b>#{ret}</b></body></html>") end
# Port to register metadata updates via http
harbor.http.register(port=8080,method="GET","/setmeta",set_meta)
# dump live_dj recordings to a file
timestamp = '%d-%m-%Y'
show_title = 'XXXXXXX'
output.file(%mp3(bitrate=320, id3v2=true), reopen_on_metadata=false, "/var/www/html/recorded_shows/#{show_title} Recorded On #{timestamp}.mp3", live, fallible=true)
# Output to an Icecast Server
output.icecast(
%mp3(bitrate=192),
mount="/stream",
host="localhost", port=8000, password="XXXXXXXX",
radio)