From 6465a6f282bef4e5c47b31a68c12e69759f778f2 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 16 Aug 2019 18:38:04 +0200 Subject: [PATCH] Added start/stop preview camera actions --- platypush/plugins/camera/pi.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/platypush/plugins/camera/pi.py b/platypush/plugins/camera/pi.py index 5e39ff983..e0a9f7ae1 100644 --- a/platypush/plugins/camera/pi.py +++ b/platypush/plugins/camera/pi.py @@ -76,6 +76,25 @@ class CameraPiPlugin(CameraPlugin): return self._camera + @action + def start_preview(self, **opts): + """ + Start camera preview. + + :param opts: Extra options to pass to the camera (see + https://www.raspberrypi.org/documentation/usage/camera/python/README.md) + """ + camera = self._get_camera(**opts) + camera.start_preview() + + @action + def stop_preview(self): + """ + Stop camera preview. + """ + camera = self._get_camera() + camera.stop_preview() + @action def take_picture(self, image_file, preview=False, warmup_time=2, resize=None, **opts): """