strix

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

commit abb728e704715bf87e1aa9bee0d055a3bc1dea25
parent 19d599f49fdd69281fabfc23be230c274906fc44
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sat, 28 Sep 2024 11:54:24 -0700

api: Add ./ui to TEMPLATE_PATH

bottle has started complaining about passing absolute paths to
template(), so add the ./ui/ directory to the search path instead.

Fixes #31

Diffstat:
Msrc/strix/api.py | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/strix/api.py b/src/strix/api.py @@ -23,6 +23,7 @@ import os import mimetypes mimetypes.add_type("video/mp4", ".m4v") +import bottle from bottle import abort, install, route, run, static_file, request, Response, JSONPlugin from bottle import template from json import dumps @@ -31,6 +32,8 @@ from threading import Thread from . import logger from .events import camera_events, EventCache, queue_events +bottle.TEMPLATE_PATH.insert(0, os.path.dirname(__file__)+"/ui/") + TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def timestr_to_dt(rfc_str): return datetime.strptime(rfc_str, TIME_FORMAT) @@ -59,7 +62,7 @@ def run_api(logging_queue, base_dir, cameras, host, port, debug, queue_rx): abort(404) listing = sorted([os.path.basename(f) for f in glob(path + "/*.jpg")]) - return template(os.path.dirname(__file__)+"/ui/dirlist.tmpl", listing=listing) + return template("dirlist.tmpl", listing=listing) @route('/api/cameras/list') def serve_cameras_list() -> Response: