Show live Horizon terrain and radar views in the web panel
This commit is contained in:
@@ -94,14 +94,15 @@ class Store:
|
||||
with self.lock, self.db:
|
||||
self.db.execute("DELETE FROM pairings")
|
||||
|
||||
def append(self, snapshot, public):
|
||||
def append(self, snapshot, public, *, capture_frame=True):
|
||||
session, world, tick = snapshot["session"], snapshot["world"], snapshot["tick"]
|
||||
active = next((raid["id"] for raid in snapshot["raids"] if raid["active"]), 0)
|
||||
now = time.time()
|
||||
frame = zlib.compress(compact(public).encode("utf-8"), level=1)
|
||||
frame = zlib.compress(compact(public).encode("utf-8"), level=1) if capture_frame else None
|
||||
with self.lock, self.db:
|
||||
self.db.execute("INSERT OR IGNORE INTO frames VALUES (?, ?, ?, ?, ?)",
|
||||
(session, tick, world, now, frame))
|
||||
if frame is not None:
|
||||
self.db.execute("INSERT OR IGNORE INTO frames VALUES (?, ?, ?, ?, ?)",
|
||||
(session, tick, world, now, frame))
|
||||
for raid in snapshot["raids"]:
|
||||
fields = (session, raid["id"], world, now, raid["start"], raid["length"],
|
||||
int(raid["active"]), int(raid["gap"] or raid["limited"]))
|
||||
@@ -122,8 +123,9 @@ class Store:
|
||||
(SELECT rowid FROM raids ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_RAIDS,)).rowcount
|
||||
if removed or gone:
|
||||
self.db.execute("INSERT OR REPLACE INTO metadata VALUES ('history_limited','1')")
|
||||
self.db.execute("""DELETE FROM frames WHERE rowid IN
|
||||
(SELECT rowid FROM frames ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_FRAMES,))
|
||||
if frame is not None:
|
||||
self.db.execute("""DELETE FROM frames WHERE rowid IN
|
||||
(SELECT rowid FROM frames ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_FRAMES,))
|
||||
|
||||
def raids(self):
|
||||
with self.lock:
|
||||
|
||||
Reference in New Issue
Block a user