migration of Sounds; Liquidsoap 2.4 compatibility

This commit is contained in:
bkfox
2024-04-05 01:20:03 +02:00
parent 6d0f2a7395
commit 52fc161d98
9 changed files with 99 additions and 39 deletions

View File

@@ -10,9 +10,9 @@ Base liquidsoap station configuration.
{% block functions %}
{# Seek function #}
def seek(source, t) =
def seek(s, t) =
t = float_of_string(default=0.,t)
ret = source.seek(source,t)
ret = source.seek(s,t)
log("seek #{ret} seconds.")
"#{ret}"
end
@@ -30,6 +30,17 @@ def to_stream(live, stream)
add(normalize=false, [live,stream])
end
{# Skip command #}
def add_skip_command(s) =
def skip(_) =
source.skip(s)
"Done!"
end
server.register(namespace="#{source.id(s)}",
usage="skip",
description="Skip the current song.",
"skip",skip)
end
{% comment %}
An interactive source is a source that:
@@ -45,10 +56,14 @@ def interactive (id, s) =
server.register(namespace=id,
description="Get source's track remaining time",
usage="remaining",
"remaining", fun (_) -> begin json_of(source.remaining(s)) end)
"remaining", fun (_) -> begin json.stringify(source.remaining(s)) end)
s = store_metadata(id=id, size=1, s)
add_skip_command(s)
{# metadata: create an interactive variable as "{id}_meta" #}
s_meta = interactive.string("#{id}_meta", "")
s = source.on_metadata(s, fun(meta) -> s_meta.set(json.stringify(meta)))
s
end
@@ -66,9 +81,6 @@ end
set("server.socket", true)
set("server.socket.path", "{{ streamer.socket_path }}")
set("log.file.path", "{{ station.path }}/liquidsoap.log")
{% for key, value in settings.AIRCOX_LIQUIDSOAP_SET.items %}
set("{{ key|safe }}", {{ value|safe }})
{% endfor %}
{% endblock %}
{% block config_extras %}