strix

A simple web UI for motion
git clone https://www.brianlane.com/git/strix
Log | Files | Refs | LICENSE

commit db2ef4c0c7a3123806c9e0cb80e518c41c24961c
parent a986deb81a52689e5a69bab736052402579eebec
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Mon, 22 Feb 2021 07:13:48 -0800

Refresh the thumbnails every 30s

This adds refresh to the thumbnails that are still at offset 0.

Diffstat:
Msrc/strix/ui/index.html | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/strix/ui/index.html b/src/strix/ui/index.html @@ -68,9 +68,19 @@ function next_events(e) { get_events(camera_name, event_offsets.get(camera_name), 5); } +// Update all thumbnails that haven't been changed by the user +function update_events() { + cameras.map(camera => { + var camera_name = camera[0]; + if (event_offsets.get(camera_name) == 0) { + get_events(camera_name, 0, 5); + } + }); +} + function setup_page() { // Camera information will eventually be filled in by an api call - // And then the page will be populated. + // And then the page will be populated cameras = [["Camera1", 8081], ["Camera2", 8082], ["Camera3", 8083], ["Camera4", 8084]]; event_offsets = new Map(); @@ -112,6 +122,9 @@ function setup_page() { event_offsets.set(camera_name, 0); get_events(camera_name, 0, 5); }); + + // Update un-modified thumbnails every 30 seconds + setInterval(update_events, 30 * 1000); } setup_page();