commit 6f9645b1427b5e2d286ee7bb18536a92ddeca840
parent 12deb2d438d3f9b5c6a0c75d426acc1578f66e1e
Author: Brian C. Lane <bcl@brianlane.com>
Date: Sat, 26 Feb 2022 09:15:18 -0800
Add /api/cameras/list to list the camera names
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/strix/api.py b/src/strix/api.py
@@ -45,6 +45,10 @@ def run_api(logging_queue: mp.Queue, base_dir: str, host: str, port: int, debug:
def serve_motion(filepath: str) -> Response:
return static_file(filepath, root=base_dir)
+ @route('/api/cameras/list')
+ def serve_cameras_list() -> Response:
+ return {"cameras": sorted([d for d in os.listdir(base_dir) if d != "queue"])}
+
@route('/api/events/<cameras>')
def serve_events(cameras: str) -> Response:
start = timestr_to_dt(request.query.get("start", "1985-10-26 01:22:00"))