Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
added wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
leadnaut committed Sep 19, 2024
1 parent 8cd14d8 commit 549850a
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions client/drivers/camera_overlord.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@
import os
import time

picam2 = Picamera2()
picam2.start()
picam2.options['quality'] = 80
if __name__ == '__main__':
picam2 = Picamera2()
picam2.start()
picam2.options['quality'] = 80

try:
f = open('/tmp/snapshot.jpg','x')
f.close()
except:
print('Snapshot already exists')

try:
while True:
picam2.capture_file("/tmp/snapshot2.jpg")
os.replace("/tmp/snapshot2.jpg", "/tmp/snapshot.jpg")
time.sleep(0.5)
try:
f = open('/tmp/snapshot.jpg','x')
f.close()
except:
print('Snapshot already exists')
try:
while True:
picam2.capture_file("/tmp/snapshot2.jpg")
os.replace("/tmp/snapshot2.jpg", "/tmp/snapshot.jpg")
time.sleep(0.5)

except KeyboardInterrupt:
picam2.close()
print('Closed nicely')
quit()
except KeyboardInterrupt:
picam2.close()
print('Closed nicely')
quit()

0 comments on commit 549850a

Please sign in to comment.