2

我刚刚将 Liquidsoap 更新到 1.3.0,现在 get_process_lines 没有返回任何内容。

def get_request() =
  # Get the URI
  lines = get_process_lines("curl http://localhost:3000/api/v1/liquidsoap/next/my-radio")
  log("liquidsoap curl returns #{lines}")
  uri = list.hd(default="",lines)
  log("liquidsoap will try and play #{uri}")
  # Create a request
  request.create(uri)
end

我在 CHANGELOG 上阅读

- Moved get_process_lines and get_process_output to utils.liq, added optional env parameter

这是否意味着我现在必须做一些事情才能在我的脚本中使用 utils.liq ?

完整脚本如下

set("log.file",false)
set("log.stdout",true)
set("log.level",3)

def apply_metadata(m) =
  title = m["title"]
  artist = m["artist"]
  log("Now playing: #{title} by #{artist}")
end

# Our custom request function
def get_request() =
  # Get the URI
  lines = get_process_lines("curl http://localhost:3000/api/v1/liquidsoap/next/my-radio")
  log("liquidsoap curl returns #{lines}")
  uri = list.hd(default="",lines)
  log("liquidsoap will try and play #{uri}")
  # Create a request
  request.create(uri)
end

def my_safe(s) =
  security = sine()
  fallback(track_sensitive=false,[s,security])
end

s = request.dynamic(id="s",get_request)

s = on_metadata(apply_metadata,s)

s = crossfade(s)

s = my_safe(s)

# We output the stream to an icecast
# server, in ogg/vorbis format.

log("liquidsoap starting")

output.icecast(
  %mp3(id3v2=true,bitrate=128,samplerate=44100),
  host = "localhost",
  port = 8000,
  password = "PASSWORD",
  mount = "myradio",
  genre="various",
  url="http://www.myradio.fr",
  description="My Radio",
  s
)

当然,API 正在工作

$ curl http://localhost:3000/api/v1/liquidsoap/next/my-radio
annotate:title="Chamakay",artist="Blood Orange",album="Cupid Deluxe":http://localhost/stream/3.mp3

一个更简单的例子:

lines = get_process_lines("echo hi")
log("lines = #{lines}")
line = list.hd(default="",lines)
log("line = #{line}")

返回以下日志

2017/05/05 15:24:42 [lang:3] lines = []
2017/05/05 15:24:42 [lang:3] line = 

非常感谢您的帮助!

杰弗里

4

1 回答 1

0

该问题已在liquidsoap 1.3.1 中修复

固定的:

  • 修复了使用 OCaml <= 4.03 编译时的 run_process、get_process_lines、get_process_output(#437、#439)

https://github.com/savonet/liquidsoap/blob/1.3.1/CHANGES#L12

于 2017-06-13T18:08:00.243 回答