diff --git a/python_apps/pypo/pypo/pypofetch.py b/python_apps/pypo/pypo/pypofetch.py index 3325432ef..a9cc475c2 100644 --- a/python_apps/pypo/pypo/pypofetch.py +++ b/python_apps/pypo/pypo/pypofetch.py @@ -159,9 +159,9 @@ class PypoFetch(Thread): station_name = info['station_name'] fade = info['transition_fade'] - commands.append(('vars.stream_metadata_type %s\n' % stream_format)) - commands.append(('vars.station_name %s\n' % station_name)) - commands.append(('vars.default_dj_fade %s\n' % fade)) + commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8')) + commands.append(('vars.station_name %s\n' % station_name).encode('utf-8')) + commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8')) self.pypo_liquidsoap.get_telnet_dispatcher().telnet_send(commands) self.pypo_liquidsoap.clear_all_queues() @@ -185,7 +185,7 @@ class PypoFetch(Thread): while True: try: tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port']) - tn.write("exit\n") + tn.write('exit\n'.encode()) tn.read_all() self.logger.info("Liquidsoap is up and running") break @@ -221,15 +221,15 @@ class PypoFetch(Thread): # we are manually adjusting the bootup time variable so the status msg will get # updated. 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) tn.write(boot_up_time_command) - connection_status = "streams.connection_status\n" + connection_status = ("streams.connection_status\n").encode() self.logger.info(connection_status) tn.write(connection_status) - tn.write('exit\n') + tn.write('exit\n'.encode()) output = tn.read_all() except Exception as e: @@ -261,10 +261,10 @@ class PypoFetch(Thread): try: self.telnet_lock.acquire() 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) tn.write(command) - tn.write('exit\n') + tn.write('exit\n'.encode()) tn.read_all() except Exception as e: self.logger.exception(e) @@ -278,10 +278,10 @@ class PypoFetch(Thread): try: self.telnet_lock.acquire() 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) tn.write(command) - tn.write('exit\n') + tn.write('exit\n'.encode()) tn.read_all() except Exception as e: self.logger.exception(e) @@ -296,10 +296,10 @@ class PypoFetch(Thread): try: self.telnet_lock.acquire() 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) tn.write(command) - tn.write('exit\n') + tn.write('exit\n'.encode()) tn.read_all() except Exception as e: self.logger.exception(e)