From d497c665ccc4d081ec0ada5d84543704470f494f Mon Sep 17 00:00:00 2001 From: jo Date: Sat, 25 Feb 2023 14:24:14 +0100 Subject: [PATCH] refactor(playout): rename web_stream functions --- .../liquidsoap/1.4/ls_lib.liq | 9 ----- .../liquidsoap/1.4/ls_script.liq | 39 +++++++++++-------- .../liquidsoap/client/_client.py | 8 ++-- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/playout/libretime_playout/liquidsoap/1.4/ls_lib.liq b/playout/libretime_playout/liquidsoap/1.4/ls_lib.liq index 36bfc4857..d0278a33f 100644 --- a/playout/libretime_playout/liquidsoap/1.4/ls_lib.liq +++ b/playout/libretime_playout/liquidsoap/1.4/ls_lib.liq @@ -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 diff --git a/playout/libretime_playout/liquidsoap/1.4/ls_script.liq b/playout/libretime_playout/liquidsoap/1.4/ls_script.liq index 860713de6..6469f8d33 100644 --- a/playout/libretime_playout/liquidsoap/1.4/ls_script.liq +++ b/playout/libretime_playout/liquidsoap/1.4/ls_script.liq @@ -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", - 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()) diff --git a/playout/libretime_playout/liquidsoap/client/_client.py b/playout/libretime_playout/liquidsoap/client/_client.py index de6e92d1e..86103c145 100644 --- a/playout/libretime_playout/liquidsoap/client/_client.py +++ b/playout/libretime_playout/liquidsoap/client/_client.py @@ -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 = {