Handling the delay in GQRX opening and being 'usable'

Handling the delay in GQRX opening and being 'usable'
This commit is contained in:
Logan Cusano
2022-04-01 01:00:32 -04:00
parent 21aacde130
commit b972d09a65

View File

@@ -2,6 +2,7 @@ import shutil
import logging
import threading
import subprocess
import time
from telnetlib import Telnet
from BotResources import *
from time import sleep
@@ -90,6 +91,9 @@ class GQRXHandler(threading.Thread):
self.GQRXProc = subprocess.Popen(gqrx_kwargs, executable=self.GQRXEXE, shell=False, cwd=self.GQRXDir)
while not self.tel_conn():
sleep(.5)
def close_gqrx(self):
self.logger.info(f"Closing GQRX")
try:
@@ -111,7 +115,12 @@ class GQRXHandler(threading.Thread):
def create_telnet_connection(self):
self.logger.info("Creating connection")
self.tel_conn = Telnet(self.hostname, self.port)
self.tel_conn.open(self.hostname, self.port)
try:
self.tel_conn.open(self.hostname, self.port)
return True
except ConnectionRefusedError as err:
self.logger.warning(err)
return False
def change_freq(self, freq):
self.logger.debug(f"Changing freq to {freq}")