Handling the delay in GQRX opening and being 'usable'
Handling the delay in GQRX opening and being 'usable'
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user