GQRX Changes
- Better error handling; GQRX config dupes some options for an unknown reason
This commit is contained in:
Logan Cusano
2022-04-10 13:53:59 -04:00
parent 62f9e1abaa
commit a094ba581d

View File

@@ -1,3 +1,4 @@
import configparser
import shutil
import logging
import threading
@@ -213,19 +214,26 @@ class GQRXHandler(threading.Thread):
self.change_freq(_freq)
self.change_squelch(_squelch)
def creat_config(self):
from templates.gqrx_config_template import drb_defaults
config = drb_defaults
try:
with open(self.GQRX_Config_Path, 'w+') as config_file:
config_file.write(config)
except OSError as err:
self.logger.error(err)
def reset_or_create_config(self):
if self.GQRX_Config_Path.is_file():
self.logger.debug(f"Enabling AGC in the GQRX config")
enable_agc(_config_path=self.GQRX_Config_Path)
try:
self.logger.debug(f"Enabling AGC in the GQRX config")
enable_agc(_config_path=self.GQRX_Config_Path)
self.logger.debug(f"GQRX Config exists, resetting 'crashed' setting")
reset_crashed(_config_path=self.GQRX_Config_Path)
self.logger.debug(f"GQRX Config exists, resetting 'crashed' setting")
reset_crashed(_config_path=self.GQRX_Config_Path)
except configparser.DuplicateOptionError as err:
self.logger.warning(err)
self.creat_config()
else:
self.logger.debug(f"GQRX config does not exist, creating it from template")
from templates.gqrx_config_template import drb_defaults
config = drb_defaults
try:
with open(self.GQRX_Config_Path, 'w+') as config_file:
config_file.write(config)
except OSError as err:
self.logger.error(err)
self.creat_config()