refactor(playout): move liq io to liq_client
This commit is contained in:
parent
fd2381624a
commit
a9cd1fb3df
|
@ -59,6 +59,11 @@ 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:
|
||||
|
@ -125,6 +130,10 @@ class LiquidsoapClient:
|
|||
if input_fade_transition is not None:
|
||||
self._set_var("default_dj_fade", input_fade_transition)
|
||||
|
||||
def boot_timestamp_update(self, timestamp: float):
|
||||
with self.conn:
|
||||
self._set_var("bootup_time", str(timestamp))
|
||||
|
||||
def restart(self):
|
||||
logger.warning("restarting Liquidsoap")
|
||||
|
||||
|
|
|
@ -175,16 +175,13 @@ class PypoFetch(Thread):
|
|||
"""
|
||||
|
||||
try:
|
||||
with self.liq_client.conn:
|
||||
# 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.conn.write(f"vars.bootup_time {str(current_time)}")
|
||||
self.liq_client.conn.read()
|
||||
# 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)
|
||||
|
||||
self.liq_client.conn.write("streams.connection_status")
|
||||
stream_info = self.liq_client.conn.read().splitlines()[0]
|
||||
stream_info = self.liq_client.outputs_connection_status()
|
||||
except (ConnectionError, TimeoutError) as exception:
|
||||
logger.exception(exception)
|
||||
|
||||
|
|
Loading…
Reference in New Issue