diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/birdscan/__main__.py | 16 |
1 files changed, 14 insertions, 2 deletions
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__": |