fix dashboard logging bug
This commit is contained in:
parent
7f46a19749
commit
e97e5cff32
@ -161,28 +161,22 @@ def aprs_send(packet):
|
|||||||
logger.info('Packet sent to APRS-IS.')
|
logger.info('Packet sent to APRS-IS.')
|
||||||
|
|
||||||
def dashboard_loc_write(call, lat, lon, time, comment):
|
def dashboard_loc_write(call, lat, lon, time, comment):
|
||||||
#try:
|
dash_entries = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
||||||
dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
|
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment':comment})
|
||||||
# except:
|
# Clear old entries
|
||||||
# dash_entries = []
|
|
||||||
list_index = 0
|
list_index = 0
|
||||||
call_count = 0
|
call_count = 0
|
||||||
new_dash_entries = []
|
new_dash_entries = []
|
||||||
for i in dash_entries:
|
for i in dash_entries:
|
||||||
if i['call'] == call:
|
if i['call'] == call:
|
||||||
if call_count >= 25:
|
if call_count >= 25:
|
||||||
print(call_count)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
new_dash_entries.append(i)
|
new_dash_entries.append(i)
|
||||||
call_count = call_count + 1
|
call_count = call_count + 1
|
||||||
|
|
||||||
if call != i['call']:
|
if call != i['call']:
|
||||||
print('Record call: |' + i['call'] + '|')
|
|
||||||
print('Filter Call: |' + call + '|')
|
|
||||||
new_dash_entries.append(i)
|
new_dash_entries.append(i)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
list_index = list_index + 1
|
list_index = list_index + 1
|
||||||
with open(loc_file, 'w') as user_loc_file:
|
with open(loc_file, 'w') as user_loc_file:
|
||||||
@ -190,6 +184,7 @@ def dashboard_loc_write(call, lat, lon, time, comment):
|
|||||||
user_loc_file.close()
|
user_loc_file.close()
|
||||||
logger.info('User location saved for dashboard')
|
logger.info('User location saved for dashboard')
|
||||||
#logger.info(dash_entries)
|
#logger.info(dash_entries)
|
||||||
|
|
||||||
def dashboard_bb_write(call, dmr_id, time, bulletin):
|
def dashboard_bb_write(call, dmr_id, time, bulletin):
|
||||||
#try:
|
#try:
|
||||||
dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read())
|
dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read())
|
||||||
|
18
gps_data.py
18
gps_data.py
@ -161,28 +161,22 @@ def aprs_send(packet):
|
|||||||
|
|
||||||
|
|
||||||
def dashboard_loc_write(call, lat, lon, time, comment):
|
def dashboard_loc_write(call, lat, lon, time, comment):
|
||||||
#try:
|
dash_entries = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
||||||
dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
|
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment':comment})
|
||||||
# except:
|
# Clear old entries
|
||||||
# dash_entries = []
|
|
||||||
list_index = 0
|
list_index = 0
|
||||||
call_count = 0
|
call_count = 0
|
||||||
new_dash_entries = []
|
new_dash_entries = []
|
||||||
for i in dash_entries:
|
for i in dash_entries:
|
||||||
if i['call'] == call:
|
if i['call'] == call:
|
||||||
if call_count >= 25:
|
if call_count >= 25:
|
||||||
print(call_count)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
new_dash_entries.append(i)
|
new_dash_entries.append(i)
|
||||||
call_count = call_count + 1
|
call_count = call_count + 1
|
||||||
|
|
||||||
if call != i['call']:
|
if call != i['call']:
|
||||||
print('Record call: |' + i['call'] + '|')
|
|
||||||
print('Filter Call: |' + call + '|')
|
|
||||||
new_dash_entries.append(i)
|
new_dash_entries.append(i)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
list_index = list_index + 1
|
list_index = list_index + 1
|
||||||
with open(loc_file, 'w') as user_loc_file:
|
with open(loc_file, 'w') as user_loc_file:
|
||||||
@ -774,9 +768,9 @@ if __name__ == '__main__':
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
Path(the_mailbox_file).touch()
|
Path(the_mailbox_file).touch()
|
||||||
with open(the_mailbox_file, 'w') as user_loc_file:
|
with open(the_mailbox_file, 'w') as user_mail_file:
|
||||||
user_loc_file.write("[]")
|
user_mail_file.write("[]")
|
||||||
user_loc_file.close()
|
user_mail_file.close()
|
||||||
|
|
||||||
# Start the system logger
|
# Start the system logger
|
||||||
if cli_args.LOG_LEVEL:
|
if cli_args.LOG_LEVEL:
|
||||||
|
Loading…
Reference in New Issue
Block a user