Add status page #30
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -39,11 +39,15 @@ Coming soon, see <a href="https://amiok.net/gitea/W1CDN/aprs_tool/issues/16">htt
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<th> raw </th>
|
||||
<th> from </th>
|
||||
<th> last heard (utc) </th>
|
||||
<th> count </th>
|
||||
</tr>
|
||||
{% for i in stations %}
|
||||
<tr>
|
||||
<td> {{ i['raw'] }} </td>
|
||||
<td> <a href="https://digi.w1cdn.net/aprs_api/packets?from={{ i['from'] }}">{{ i['from'] }}</a> </td>
|
||||
<td> {{ i['created'] }} </td>
|
||||
<td> {{ i['COUNT(id)']}} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue
Block a user