feat(playout): remove unused liquidsoap outputs connection status

This commit is contained in:
jo 2023-02-20 21:35:47 +01:00 committed by Kyle Robbertze
parent aed90d835f
commit a0f232ba66
4 changed files with 5 additions and 61 deletions

View File

@ -95,15 +95,13 @@ def to_live(old,new) =
end
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream, connected, name, channels) =
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream, name, channels) =
source = ref s
def on_error(msg)
connected := "false"
gateway("stream '#{stream}' '#{boot_timestamp()}' --error='#{msg}'")
5.
end
def on_connect()
connected := "true"
gateway("stream '#{stream}' '#{boot_timestamp()}'")
end

View File

@ -7,10 +7,6 @@ show_name = interactive.string("show_name", "")
dynamic_metadata_callback = ref fun (~new_track=false, s) -> begin () end
s1_connected = ref ''
s2_connected = ref ''
s3_connected = ref ''
s4_connected = ref ''
s1_namespace = ref ''
s2_namespace = ref ''
s3_namespace = ref ''
@ -68,10 +64,6 @@ stream_queue = map_metadata(update=false, append_title, stream_queue)
ignore(output.dummy(stream_queue, fallible=true))
server.register(namespace="streams",
"connection_status",
fun (s) -> begin log("streams.connection_status") "1:#{!s1_connected},2:#{!s2_connected},3:#{!s3_connected},4:#{!s4_connected}" end)
server.register(namespace="dynamic_source",
description="Enable webstream output",
usage='start',
@ -324,10 +316,9 @@ if s1_enable == true then
else
s1_namespace := s1_mount
end
server.register(namespace=!s1_namespace, "connected", fun (s) -> begin log("#{!s1_namespace}.connected") !s1_connected end)
output_to(s1_output, s1_type, s1_bitrate, s1_host, s1_port, s1_pass,
s1_mount, s1_url, s1_description, s1_genre, s1_user, s, "1",
s1_connected, s1_name, s1_channels)
s1_name, s1_channels)
end
if s2_enable == true then
@ -336,10 +327,9 @@ if s2_enable == true then
else
s2_namespace := s2_mount
end
server.register(namespace=!s2_namespace, "connected", fun (s) -> begin log("#{!s2_namespace}.connected") !s2_connected end)
output_to(s2_output, s2_type, s2_bitrate, s2_host, s2_port, s2_pass,
s2_mount, s2_url, s2_description, s2_genre, s2_user, s, "2",
s2_connected, s2_name, s2_channels)
s2_name, s2_channels)
end
@ -349,10 +339,9 @@ if s3_enable == true then
else
s3_namespace := s3_mount
end
server.register(namespace=!s3_namespace, "connected", fun (s) -> begin log("#{!s3_namespace}.connected") !s3_connected end)
output_to(s3_output, s3_type, s3_bitrate, s3_host, s3_port, s3_pass,
s3_mount, s3_url, s3_description, s3_genre, s3_user, s, "3",
s3_connected, s3_name, s3_channels)
s3_name, s3_channels)
end
s4_namespace = ref ''
@ -363,10 +352,9 @@ if s4_enable == true then
else
s4_namespace := s4_mount
end
server.register(namespace=!s4_namespace, "connected", fun (s) -> begin log("#{!s4_namespace}.connected") !s4_connected end)
output_to(s4_output, s4_type, s4_bitrate, s4_host, s4_port, s4_pass,
s4_mount, s4_url, s4_name, s4_genre, s4_user, s, "4",
s4_connected, s4_description, s4_channels)
s4_description, s4_channels)
end

View File

@ -65,11 +65,6 @@ class LiquidsoapClient:
raise LiquidsoapClientError("could not get liquidsoap version")
def outputs_connection_status(self):
with self.conn:
self.conn.write("streams.connection_status")
return self.conn.read().splitlines()[0]
def queues_remove(self, *queues: int) -> None:
with self.conn:
for queue_id in queues:
@ -139,10 +134,6 @@ class LiquidsoapClient:
if input_fade_transition is not None:
self._set_var("input_fade_transition", input_fade_transition)
def boot_timestamp_update(self, timestamp: float):
with self.conn:
self._set_var("boot_timestamp", self._quote(timestamp))
def restart(self):
logger.warning("restarting Liquidsoap")

View File

@ -159,39 +159,6 @@ class PypoFetch(Thread):
self.pypo_liquidsoap.clear_all_queues()
self.pypo_liquidsoap.clear_queue_tracker()
@ls_timeout
def update_liquidsoap_connection_status(self):
"""
updates the status of Liquidsoap connection to the streaming server
This function updates the bootup time variable in Liquidsoap script
"""
try:
# update the boot up time of Liquidsoap. Since Liquidsoap is not restarting,
# we are manually adjusting the bootup time variable so the status msg will get
# updated.
current_time = time.time()
self.liq_client.boot_timestamp_update(current_time)
stream_info = self.liq_client.outputs_connection_status()
except (ConnectionError, TimeoutError) as exception:
logger.exception(exception)
# streamin info is in the form of:
# eg. s1:true,2:true,3:false
streams = stream_info.split(",")
logger.info(streams)
fake_time = current_time + 1
for stream in streams:
info = stream.split(":")
stream_id = info[0]
status = info[1]
if status == "true":
self.legacy_client.notify_liquidsoap_status(
"OK", stream_id, str(fake_time)
)
@ls_timeout
def update_liquidsoap_stream_format(self, stream_format):
try: