mirror of
https://github.com/ShaYmez/HBmonitor.git
synced 2024-11-21 15:41:52 -05:00
Update monitor.py
fix the problem when user data do sometimes not type bytes but string
This commit is contained in:
parent
17271ba41e
commit
5830b9f100
28
monitor.py
28
monitor.py
@ -222,7 +222,7 @@ def add_hb_peer(_peer_conf, _ctable_loc, _peer):
|
|||||||
# if the Frequency is 000.xxx assume it's not an RF peer, otherwise format the text fields
|
# if the Frequency is 000.xxx assume it's not an RF peer, otherwise format the text fields
|
||||||
# (9 char, but we are just software) see https://wiki.brandmeister.network/index.php/Homebrew/example/php2
|
# (9 char, but we are just software) see https://wiki.brandmeister.network/index.php/Homebrew/example/php2
|
||||||
|
|
||||||
if _peer_conf['TX_FREQ'].isalnum() and _peer_conf['RX_FREQ'].isalnum():
|
if _peer_conf['TX_FREQ'].isalnum() and _peer_conf['RX_FREQ'].isalnum() and str(type(_peer_conf['TX_FREQ'])).find("bytes") != -1 and str(type(_peer_conf['RX_FREQ'])).find("bytes") != -1:
|
||||||
if _peer_conf['TX_FREQ'][:3] == b'000' or _peer_conf['RX_FREQ'][:3] == b'000':
|
if _peer_conf['TX_FREQ'][:3] == b'000' or _peer_conf['RX_FREQ'][:3] == b'000':
|
||||||
_ctable_peer['TX_FREQ'] = 'N/A'
|
_ctable_peer['TX_FREQ'] = 'N/A'
|
||||||
_ctable_peer['RX_FREQ'] = 'N/A'
|
_ctable_peer['RX_FREQ'] = 'N/A'
|
||||||
@ -245,11 +245,27 @@ def add_hb_peer(_peer_conf, _ctable_loc, _peer):
|
|||||||
_ctable_peer['SLOTS'] = 'Simplex'
|
_ctable_peer['SLOTS'] = 'Simplex'
|
||||||
|
|
||||||
# Simple translation items
|
# Simple translation items
|
||||||
_ctable_peer['SOFTWARE_ID'] = _peer_conf['SOFTWARE_ID'].decode('utf-8').strip()
|
if str(type(_peer_conf['PACKAGE_ID'])).find("bytes") != -1:
|
||||||
_ctable_peer['PACKAGE_ID'] = _peer_conf['PACKAGE_ID'].decode('utf-8').strip()
|
_ctable_peer['PACKAGE_ID'] = _peer_conf['PACKAGE_ID'].decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
_ctable_peer['PACKAGE_ID'] = _peer_conf['PACKAGE_ID']
|
||||||
|
|
||||||
|
if str(type(_peer_conf['SOFTWARE_ID'])).find("bytes") != -1:
|
||||||
|
_ctable_peer['SOFTWARE_ID'] = _peer_conf['SOFTWARE_ID'].decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
_ctable_peer['SOFTWARE_ID'] = _peer_conf['SOFTWARE_ID']
|
||||||
|
|
||||||
|
if str(type(_peer_conf['LOCATION'])).find("bytes") != -1:
|
||||||
|
_ctable_peer['LOCATION'] = _peer_conf['LOCATION'].decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
_ctable_peer['LOCATION'] = _peer_conf['LOCATION']
|
||||||
|
|
||||||
|
if str(type(_peer_conf['CALLSIGN'])).find("bytes") != -1:
|
||||||
|
_ctable_peer['CALLSIGN'] = _peer_conf['CALLSIGN'].decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
_ctable_peer['CALLSIGN'] = _peer_conf['CALLSIGN']
|
||||||
|
|
||||||
_ctable_peer['COLORCODE'] = _peer_conf['COLORCODE'].decode('utf-8')
|
_ctable_peer['COLORCODE'] = _peer_conf['COLORCODE'].decode('utf-8')
|
||||||
_ctable_peer['CALLSIGN'] = _peer_conf['CALLSIGN'].decode('utf-8')
|
|
||||||
_ctable_peer['LOCATION'] = _peer_conf['LOCATION'].decode('utf-8')
|
|
||||||
_ctable_peer['CONNECTION'] = _peer_conf['CONNECTION']
|
_ctable_peer['CONNECTION'] = _peer_conf['CONNECTION']
|
||||||
_ctable_peer['CONNECTED'] = since(_peer_conf['CONNECTED'])
|
_ctable_peer['CONNECTED'] = since(_peer_conf['CONNECTED'])
|
||||||
_ctable_peer['IP'] = _peer_conf['IP']
|
_ctable_peer['IP'] = _peer_conf['IP']
|
||||||
@ -802,7 +818,7 @@ if __name__ == '__main__':
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
logging.info('monitor.py starting up')
|
logging.info('monitor.py starting up')
|
||||||
logger.info('\n\n\tCopyright (c) 2016, 2017, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n\n\tPython 3 port:\n\t2019 Steve Miller, KC1AWV <smiller@kc1awv.net>\n\n\tVersion by:\t SP2ONG 2019-2020\n\n')
|
logger.info('\n\n\tCopyright (c) 2016, 2017, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n\n\tPython 3 port:\n\t2019 Steve Miller, KC1AWV <smiller@kc1awv.net>\n\n\tVersion by:\t SP2ONG 2019-2021\n\n')
|
||||||
|
|
||||||
# Download alias files
|
# Download alias files
|
||||||
result = try_download(PATH, PEER_FILE, PEER_URL, (FILE_RELOAD * 86400))
|
result = try_download(PATH, PEER_FILE, PEER_URL, (FILE_RELOAD * 86400))
|
||||||
|
Loading…
Reference in New Issue
Block a user