Ok hopefully this is it. python3 requries a bytestring https://docs.python.org/3.7/library/telnetlib.html
This commit is contained in:
parent
dd46b4c984
commit
0289f84111
1 changed files with 13 additions and 13 deletions
|
@ -159,9 +159,9 @@ class PypoFetch(Thread):
|
||||||
station_name = info['station_name']
|
station_name = info['station_name']
|
||||||
fade = info['transition_fade']
|
fade = info['transition_fade']
|
||||||
|
|
||||||
commands.append(('vars.stream_metadata_type %s\n' % stream_format))
|
commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8'))
|
||||||
commands.append(('vars.station_name %s\n' % station_name))
|
commands.append(('vars.station_name %s\n' % station_name).encode('utf-8'))
|
||||||
commands.append(('vars.default_dj_fade %s\n' % fade))
|
commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8'))
|
||||||
self.pypo_liquidsoap.get_telnet_dispatcher().telnet_send(commands)
|
self.pypo_liquidsoap.get_telnet_dispatcher().telnet_send(commands)
|
||||||
|
|
||||||
self.pypo_liquidsoap.clear_all_queues()
|
self.pypo_liquidsoap.clear_all_queues()
|
||||||
|
@ -185,7 +185,7 @@ class PypoFetch(Thread):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
||||||
tn.write("exit\n")
|
tn.write('exit\n'.encode())
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
self.logger.info("Liquidsoap is up and running")
|
self.logger.info("Liquidsoap is up and running")
|
||||||
break
|
break
|
||||||
|
@ -221,15 +221,15 @@ class PypoFetch(Thread):
|
||||||
# we are manually adjusting the bootup time variable so the status msg will get
|
# we are manually adjusting the bootup time variable so the status msg will get
|
||||||
# updated.
|
# updated.
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
boot_up_time_command = "vars.bootup_time " + str(current_time) + "\n"
|
boot_up_time_command = ("vars.bootup_time " + str(current_time) + "\n").encode()
|
||||||
self.logger.info(boot_up_time_command)
|
self.logger.info(boot_up_time_command)
|
||||||
tn.write(boot_up_time_command)
|
tn.write(boot_up_time_command)
|
||||||
|
|
||||||
connection_status = "streams.connection_status\n"
|
connection_status = ("streams.connection_status\n").encode()
|
||||||
self.logger.info(connection_status)
|
self.logger.info(connection_status)
|
||||||
tn.write(connection_status)
|
tn.write(connection_status)
|
||||||
|
|
||||||
tn.write('exit\n')
|
tn.write('exit\n'.encode())
|
||||||
|
|
||||||
output = tn.read_all()
|
output = tn.read_all()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -261,10 +261,10 @@ class PypoFetch(Thread):
|
||||||
try:
|
try:
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
||||||
command = ('vars.stream_metadata_type %s\n' % stream_format)
|
command = ('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8')
|
||||||
self.logger.info(command)
|
self.logger.info(command)
|
||||||
tn.write(command)
|
tn.write(command)
|
||||||
tn.write('exit\n')
|
tn.write('exit\n'.encode())
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
|
@ -278,10 +278,10 @@ class PypoFetch(Thread):
|
||||||
try:
|
try:
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
||||||
command = ('vars.default_dj_fade %s\n' % fade)
|
command = ('vars.default_dj_fade %s\n' % fade).encode('utf-8')
|
||||||
self.logger.info(command)
|
self.logger.info(command)
|
||||||
tn.write(command)
|
tn.write(command)
|
||||||
tn.write('exit\n')
|
tn.write('exit\n'.encode())
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
|
@ -296,10 +296,10 @@ class PypoFetch(Thread):
|
||||||
try:
|
try:
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port'])
|
||||||
command = ('vars.station_name %s\n' % station_name)
|
command = ('vars.station_name %s\n' % station_name).encode('utf-8')
|
||||||
self.logger.info(command)
|
self.logger.info(command)
|
||||||
tn.write(command)
|
tn.write(command)
|
||||||
tn.write('exit\n')
|
tn.write('exit\n'.encode())
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue