From e6ace9e72d715f0aef77b5dbf4782e384ff1efba Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Thu, 11 Mar 2021 08:02:24 -0800 Subject: [PATCH] fix missing code from bridge_gps_data.py --- bridge_gps_data.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/bridge_gps_data.py b/bridge_gps_data.py index ab28376..1ea62e3 100755 --- a/bridge_gps_data.py +++ b/bridge_gps_data.py @@ -165,13 +165,31 @@ def dashboard_loc_write(call, lat, lon, time, comment): dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read()) # except: # 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: - user_loc_file.write(str(dash_entries[:200])) + user_loc_file.write(str(new_dash_entries[:500])) user_loc_file.close() logger.info('User location saved for dashboard') #logger.info(dash_entries) - def dashboard_bb_write(call, dmr_id, time, bulletin): #try: dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read())