fix missing code from bridge_gps_data.py

This commit is contained in:
KF7EEL 2021-03-11 08:02:24 -08:00
parent 1fb22d01c6
commit e6ace9e72d

View File

@ -165,13 +165,31 @@ def dashboard_loc_write(call, lat, lon, time, comment):
dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read()) dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
# except: # except:
# dash_entries = [] # dash_entries = []
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment': comment}) list_index = 0
call_count = 0
new_dash_entries = []
for i in dash_entries:
if i['call'] == call:
if call_count >= 25:
print(call_count)
pass
else:
new_dash_entries.append(i)
call_count = call_count + 1
if call != i['call']:
print('Record call: |' + i['call'] + '|')
print('Filter Call: |' + call + '|')
new_dash_entries.append(i)
pass
list_index = list_index + 1
with open(loc_file, 'w') as user_loc_file: with open(loc_file, 'w') as user_loc_file:
user_loc_file.write(str(dash_entries[:200])) user_loc_file.write(str(new_dash_entries[:500]))
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())