所以我有一个 Liquidsoap 实例,在端口 8080 上有一个港口输入。
我希望发生的事情是,每当有人连接到 /live 时,流就会被记录并保存在服务器上。
这很好用,但是,例如,如果我正在录制,然后断开连接并允许播放列表启动,当我再次尝试流式传输时,它会创建一个新文件,但会开始写入新文件和以前的录制文件。
它基本上是在写第一个文件。唯一不会发生这种情况的方法是,如果liquidsoap 在两次广播之间重新启动。
这是我的 liq 文件的副本:
#!/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)