From 546795c2b6939c7f02215cb09fa864883c7d1b95 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 5 Dec 2020 11:39:05 +0100 Subject: [PATCH] expose ptz --- server.py | 12 ++++++++++++ static/js/cccc.js | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index e95c46e..a9884da 100755 --- a/server.py +++ b/server.py @@ -120,6 +120,18 @@ class API(object): json.dump(data, fd, indent=4) return result + def move(self, **data): + result = {} + if data.get('direction') in ( + 'LEFT', 'RIGHT', 'UP', 'DOWN', + 'LEFT_UP', 'LEFT_DOWN', + 'RIGHT_UP', 'RIGHT_DOWN', + 'IN', 'OUT', + ): + direction = getattr(ctl.camera, data['direction']) + ctl.camera.momentary(direction, float(data.get('duration', 1))) + return result + def stop(self, **data): result = {} ctl.camera.abort = True diff --git a/static/js/cccc.js b/static/js/cccc.js index 6ef7231..dfec645 100644 --- a/static/js/cccc.js +++ b/static/js/cccc.js @@ -662,5 +662,4 @@ function init_shift() { updateShiftStatus() setInterval(updateShiftStatus, 5000) }) - }