mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-10-30 22:01:57 +01:00
Update qrz.py
This commit is contained in:
1 parent
5733c4174d
commit
c52a59b76a
1 file changed
+3
-3
+3
-3
@@ -6,7 +6,7 @@ import sqlite3
|
|||||||
from modules.log import logger
|
from modules.log import logger
|
||||||
from modules.settings import qrz_db
|
from modules.settings import qrz_db
|
||||||
|
|
||||||
def initalize_qrz_database():
|
def initialize_qrz_database():
|
||||||
try:
|
try:
|
||||||
# If the database file doesn't exist, it will be created by sqlite3.connect
|
# If the database file doesn't exist, it will be created by sqlite3.connect
|
||||||
if not os.path.exists(qrz_db):
|
if not os.path.exists(qrz_db):
|
||||||
@@ -41,7 +41,7 @@ def never_seen_before(nodeID):
|
|||||||
return False
|
return False
|
||||||
except sqlite3.OperationalError as e:
|
except sqlite3.OperationalError as e:
|
||||||
if "no such table" in str(e):
|
if "no such table" in str(e):
|
||||||
initalize_qrz_database()
|
initialize_qrz_database()
|
||||||
logger.warning("QRZ database table not found, created new table")
|
logger.warning("QRZ database table not found, created new table")
|
||||||
# we have not seen this node before
|
# we have not seen this node before
|
||||||
return True
|
return True
|
||||||
@@ -56,7 +56,7 @@ def hello(nodeID, name):
|
|||||||
c.execute("INSERT INTO qrz (qrz_call, qrz_name) VALUES (?, ?)", (nodeID, str(name)))
|
c.execute("INSERT INTO qrz (qrz_call, qrz_name) VALUES (?, ?)", (nodeID, str(name)))
|
||||||
except sqlite3.OperationalError as e:
|
except sqlite3.OperationalError as e:
|
||||||
if "no such table" in str(e):
|
if "no such table" in str(e):
|
||||||
initalize_qrz_database()
|
initialize_qrz_database()
|
||||||
c.execute("INSERT INTO qrz (qrz_call, qrz_name) VALUES (?, ?)", (nodeID, str(name)))
|
c.execute("INSERT INTO qrz (qrz_call, qrz_name) VALUES (?, ?)", (nodeID, str(name)))
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in new issue
Block a user