diff --git a/api_app.py b/api_app.py index 4840fca..bf55831 100644 --- a/api_app.py +++ b/api_app.py @@ -76,7 +76,7 @@ def unique_stations(conn): :return: """ cur = conn.cursor() - cur.execute('SELECT *, MAX(id) FROM frames GROUP BY "from" ORDER BY MAX(id) DESC') + cur.execute('SELECT *, MAX(id), COUNT(id) FROM frames GROUP BY "from" ORDER BY MAX(id) DESC') rows = cur.fetchall() return rows diff --git a/tcp_kiss_send_recv.py b/tcp_kiss_send_recv.py index 4e6fe5a..c168b8f 100644 --- a/tcp_kiss_send_recv.py +++ b/tcp_kiss_send_recv.py @@ -82,6 +82,8 @@ def main(): conn = get_db_connection() for frame in ki.read(min_frames=1): a = aprslib.parse(str(frame)) + # Add information about *this* station - might be useful for + # combining data across stations in the future. a['station_call'] = config['Settings']['station_call'] a['station_lat'] = config['Settings']['station_lat'] a['station_lon'] = config['Settings']['station_lon'] @@ -94,6 +96,9 @@ def main(): sql = f"INSERT INTO frames ({attrib_names}) VALUES ({attrib_values})" # Insert data conn.execute(sql, list(a.values())) + + # TODO update stations table here + conn.commit() # TODO remove packets that are older ('created') than a limit set in config.ini diff --git a/templates/index.html b/templates/index.html index 5678d2e..22bf7eb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,11 +39,15 @@ Coming soon, see htt
raw | +from | +last heard (utc) | +count |
---|---|---|---|
{{ i['raw'] }} | +{{ i['from'] }} | +{{ i['created'] }} | +{{ i['COUNT(id)']}} |