【问题标题】:Clearing all files from a Liquidsoap equeue, to schedule playlists清除 Liquidsoap 队列中的所有文件,以安排播放列表
【发布时间】:2020-05-19 10:36:51
【问题描述】:

我正在使用equeue 通过将曲目推入播放列表来播放它。假设一个小时后,一个新的播放列表(一组文件)被推送到队列中。不幸的是,这些曲目没有开始播放,因为它们在之前排队的文件之后排队。

以下脚本从队列中删除文件:

input_fs = request.equeue(id="fs")

def clear_items(s) =
    ret = server.execute("fs.primary_queue")
    ret = list.hd(ret)
    if ret == "" then
        log("Queue cleared.")
        (-1.)
    else
        log("There are still items in the queue, trying skip ...")
        source.skip(s)
        (0.1)
    end
end

def clear_queue(s) =
    add_timeout(fast=false, 0.5, {clear_items(s)})
end

server.register(namespace="fs",
    description="Clear the all items of the filesystem queue.",
    usage="clear",
    "clear",
    fun (s) -> begin clear_queue(input_fs) "Done." end)

它在通过 Telnet 调用时有效,但也会增加一些额外的超时。因此,下一个播放列表的安排会有所延迟。

注意,我正在通过 Python 应用程序执行 LiquidSoap 调度,该应用程序使用定时线程推送到队列。

您认为解决此问题的推荐方法是什么?

【问题讨论】:

    标签: python telnet liquidsoap


    【解决方案1】:

    我通过引入两个文件系统队列 A 和 B 解决了这个问题。

    1. 队列 A 填充了播放列表项并播放了
    2. 一段时间后,队列 B 也已填充,但尚未播放。
    3. 当播放过渡到队列 B 并开始播放后,就有足够的时间来清除 队列 A 中剩余的所有内容

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-07
      • 2015-03-04
      • 2020-09-27
      • 1970-01-01
      • 2022-01-01
      • 2013-11-22
      相关资源
      最近更新 更多