chore(playout): remove unused code (#2058)
This commit is contained in:
parent
f8de1ec865
commit
bddbdf716c
4 changed files with 0 additions and 182 deletions
|
@ -53,17 +53,6 @@ class TelnetLiquidsoap:
|
|||
def __connect(self):
|
||||
return telnetlib.Telnet(self.ls_host, self.ls_port)
|
||||
|
||||
def __is_empty(self, queue_id):
|
||||
return True
|
||||
connection = self.__connect()
|
||||
msg = "%s.queue\nexit\n" % queue_id
|
||||
connection.write(msg.encode("utf-8"))
|
||||
output = connection.read_all().decode("utf-8").splitlines()
|
||||
if len(output) == 3:
|
||||
return len(output[0]) == 0
|
||||
else:
|
||||
raise Exception("Unexpected list length returned: %s" % output)
|
||||
|
||||
@ls_timeout
|
||||
def queue_clear_all(self):
|
||||
try:
|
||||
|
@ -100,9 +89,6 @@ class TelnetLiquidsoap:
|
|||
try:
|
||||
self.telnet_lock.acquire()
|
||||
|
||||
if not self.__is_empty(queue_id):
|
||||
raise QueueNotEmptyException()
|
||||
|
||||
connection = self.__connect()
|
||||
annotation = create_liquidsoap_annotation(media_item)
|
||||
msg = f"{queue_id}.push {annotation}\n"
|
||||
|
@ -283,43 +269,3 @@ class TelnetLiquidsoap:
|
|||
command += "stop\n"
|
||||
|
||||
self.telnet_send([command])
|
||||
|
||||
|
||||
class DummyTelnetLiquidsoap:
|
||||
def __init__(self, telnet_lock):
|
||||
self.telnet_lock = telnet_lock
|
||||
self.liquidsoap_mock_queues = {}
|
||||
|
||||
for index in range(4):
|
||||
self.liquidsoap_mock_queues["s" + str(index)] = []
|
||||
|
||||
@ls_timeout
|
||||
def queue_push(self, queue_id, media_item):
|
||||
try:
|
||||
self.telnet_lock.acquire()
|
||||
|
||||
logger.info(f"Pushing {media_item} to queue {queue_id}")
|
||||
from datetime import datetime
|
||||
|
||||
print(f"Time now: {datetime.utcnow():s}")
|
||||
|
||||
annotation = create_liquidsoap_annotation(media_item)
|
||||
self.liquidsoap_mock_queues[queue_id].append(annotation)
|
||||
finally:
|
||||
self.telnet_lock.release()
|
||||
|
||||
@ls_timeout
|
||||
def queue_remove(self, queue_id):
|
||||
try:
|
||||
self.telnet_lock.acquire()
|
||||
|
||||
logger.info("Purging queue %s" % queue_id)
|
||||
from datetime import datetime
|
||||
|
||||
print(f"Time now: {datetime.utcnow():s}")
|
||||
finally:
|
||||
self.telnet_lock.release()
|
||||
|
||||
|
||||
class QueueNotEmptyException(Exception):
|
||||
pass
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import math
|
||||
import telnetlib
|
||||
import time
|
||||
from datetime import datetime
|
||||
from queue import Queue
|
||||
|
@ -8,7 +7,6 @@ from threading import Thread
|
|||
from loguru import logger
|
||||
|
||||
from ..config import PUSH_INTERVAL, Config
|
||||
from ..timeout import ls_timeout
|
||||
from .queue import PypoLiqQueue
|
||||
|
||||
|
||||
|
@ -95,36 +93,6 @@ class PypoPush(Thread):
|
|||
|
||||
return present, future
|
||||
|
||||
@ls_timeout
|
||||
def stop_web_stream_all(self):
|
||||
try:
|
||||
self.telnet_lock.acquire()
|
||||
tn = telnetlib.Telnet(
|
||||
self.config.playout.liquidsoap_host,
|
||||
self.config.playout.liquidsoap_port,
|
||||
)
|
||||
|
||||
# msg = 'dynamic_source.read_stop_all xxx\n'
|
||||
msg = "http.stop\n"
|
||||
logger.debug(msg)
|
||||
tn.write(msg)
|
||||
|
||||
msg = "dynamic_source.output_stop\n"
|
||||
logger.debug(msg)
|
||||
tn.write(msg)
|
||||
|
||||
msg = "dynamic_source.id -1\n"
|
||||
logger.debug(msg)
|
||||
tn.write(msg)
|
||||
|
||||
tn.write("exit\n")
|
||||
logger.debug(tn.read_all())
|
||||
|
||||
except Exception as exception:
|
||||
logger.exception(exception)
|
||||
finally:
|
||||
self.telnet_lock.release()
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue