refactor(playout): rename web_stream functions

This commit is contained in:
jo 2023-02-25 14:24:14 +01:00 committed by Kyle Robbertze
parent 196fc1ddf8
commit d497c665cc
3 changed files with 26 additions and 30 deletions

View File

@ -207,15 +207,6 @@ def clear_queue(s)
source.skip(s)
end
def set_web_stream_id(id) =
web_stream_id := id
string_of(!web_stream_id)
end
def get_web_stream_id() =
string_of(!web_stream_id)
end
# NOTE
# A few values are hardcoded and may be dependent:
# - the delay in gracetime is linked with the buffer duration of input.http

View File

@ -61,30 +61,35 @@ stream_queue = map_metadata(id="map_metadata:schedule", update=false, append_tit
ignore(output.dummy(stream_queue, fallible=true))
server.register(namespace="web_stream",
description="Enable webstream output",
usage='start',
"output_start",
fun (s) -> begin log("web_stream.output_start")
def web_stream_set_id(value)
web_stream_id := value
string_of(!web_stream_id)
end
def web_stream_get_id()
string_of(!web_stream_id)
end
server.register(namespace="sources",
description="Start webstream source",
"start_web_stream",
fun (s) -> begin log("sources.start_web_stream")
notify([("schedule_table_id", !web_stream_id)])
web_stream_enabled := true "enabled" end)
server.register(namespace="web_stream",
description="Enable webstream output",
usage='stop',
"output_stop",
fun (s) -> begin log("web_stream.output_stop") web_stream_enabled := false "disabled" end)
server.register(namespace="sources",
description="Stop webstream source",
"stop_web_stream",
fun (s) -> begin log("sources.stop_web_stream") web_stream_enabled := false "disabled" end)
server.register(namespace="web_stream",
description="Set the streams cc_schedule row id",
usage="id <id>",
"id",
fun (s) -> begin log("web_stream.id") set_web_stream_id(s) end)
description="Set the web stream id",
"set_id",
fun (s) -> begin log("web_stream.set_id") web_stream_set_id(s) end)
server.register(namespace="web_stream",
description="Get the streams cc_schedule row id",
usage="get_id",
description="Get the web stream id",
"get_id",
fun (s) -> begin log("web_stream.get_id") get_web_stream_id() end)
fun (s) -> begin log("web_stream.get_id") web_stream_get_id() end)
default = amplify(id="silence_src", 0.00001, noise())

View File

@ -83,21 +83,21 @@ class LiquidsoapClient:
def web_stream_start(self) -> None:
with self.conn:
self.conn.write("sources.start_schedule")
self.conn.write("web_stream.output_start")
self.conn.write("sources.start_web_stream")
def web_stream_start_buffer(self, schedule_id: int, uri: str) -> None:
with self.conn:
self.conn.write(f"web_stream.id {schedule_id}")
self.conn.write(f"web_stream.set_id {schedule_id}")
self.conn.write(f"http.restart {uri}")
def web_stream_stop(self) -> None:
with self.conn:
self.conn.write("web_stream.output_stop")
self.conn.write("sources.stop_web_stream")
def web_stream_stop_buffer(self) -> None:
with self.conn:
self.conn.write("http.stop")
self.conn.write("web_stream.id -1")
self.conn.write("web_stream.set_id -1")
def source_disconnect(self, name: Literal["master_dj", "live_dj"]) -> None:
command_map = {