Add status page #30

Merged
W1CDN merged 36 commits from dashboard-page into main 2023-08-26 19:05:45 -05:00
Showing only changes of commit c0ff61063f - Show all commits

View File

@ -61,6 +61,7 @@ def main():
attrib_names = ', '.join('"%s"' % w for w in a.keys())
attrib_values = ", ".join("?" * len(a.keys()))
sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
try:
# Insert data
conn.execute(sql, list(a.values()))
@ -71,13 +72,17 @@ def main():
# It's not immediately needed, so I'm skipping it.
# Build query
# "from" is wrappedin [] because it is a reserved word and using '' doesn't work.
station_update = ", ".join((a['from'], a['created_unix'], "1"))
query3 = "INSERT INTO stations ([from], last_heard_unix, count) \
VALUES("+station_update+", 1) \
ON CONFLICT([from]) \
DO UPDATE SET count = count + 1;"
# Insert/update data
conn.execute(query3)
try:
station_update = "'"+a['from'] +"', '"+ str(a['created_unix']) +"', '1'"
query3 = "INSERT INTO stations ([from], last_heard_unix, count) \
VALUES("+station_update+") \
ON CONFLICT([from]) \
DO UPDATE SET count = count + 1;"
print(query3)
# Insert/update data
conn.execute(query3)
except:
print("Stations table couldn't be updated.")
conn.commit()