From 52972b810a9a42cef5c88f9947d64a0705f243ac Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 17 Jun 2021 09:00:07 +0200 Subject: Implement single Picture Mode --- python/birdscan/__main__.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/birdscan/__main__.py b/python/birdscan/__main__.py index a25dee2..77fae73 100644 --- a/python/birdscan/__main__.py +++ b/python/birdscan/__main__.py @@ -8,15 +8,27 @@ This is the main executable of the birdscan package. """ +import sys import time def main(): """Main function of this module""" - while True: - print("Active!") + if len(sys.argv) == 2: # check if argument is given (--debug) time.sleep(1) + sys.stdout.write("ok") + else: + from picamera import PiCamera + camera = PiCamera() + camera.resolution = "3280x2464" + camera.start_preview() + # Camera warm-up time + time.sleep(2) + camera.capture("/var/lib/birdscan/{}.jpg".format( + time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())) + ) + sys.stdout.write("ok") if __name__ == "__main__": -- cgit v1.2.3-70-g09d2