summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2011-03-04 15:36:44 -0500
committerLuke Macken <lmacken@redhat.com>2011-03-04 15:36:44 -0500
commit9e23bf79f46b6ee221ad0f58cc3165674e09e3f0 (patch)
treec0b8146840e92cbe7880b55c122f24c4afc01c3a
parentc84779c840f29346115906ea4fb7cf7b40f29ea3 (diff)
downloadphotobooth-9e23bf79f46b6ee221ad0f58cc3165674e09e3f0.tar.gz
photobooth-9e23bf79f46b6ee221ad0f58cc3165674e09e3f0.tar.xz
photobooth-9e23bf79f46b6ee221ad0f58cc3165674e09e3f0.zip
Apply a patch from Jared Smith to initialize the camera once at startup
-rw-r--r--photobooth.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/photobooth.py b/photobooth.py
index 93fee0a..5162283 100644
--- a/photobooth.py
+++ b/photobooth.py
@@ -36,18 +36,25 @@ delete_after_upload = True
gphoto_config = {
'/main/imgsettings/imagesize': 3, # small
'/main/imgsettings/imagequality': 0, # normal
+ '/main/capturesettings/zoom': 70, # zoom factor
}
class PhotoBooth(object):
+ def initialize(self):
+ """ Detect the camera and set the various settings """
+ cfg = ['--set-config=%s=%s' % (k, v) for k, v in gphoto_config.items()]
+ subprocess.call('gphoto2 --auto-detect ' +
+ ' '.join(cfg), shell=True)
+
def capture_photo(self):
""" Capture a photo and download it from the camera """
filename = join(out, '%s.jpg' % str(uuid4()))
cfg = ['--set-config=%s=%s' % (k, v) for k, v in gphoto_config.items()]
- subprocess.call('gphoto2 --auto-detect ' +
+ subprocess.call('gphoto2 ' +
'--capture-image-and-download ' +
- '--filename="%s" ' % filename +
- ' '.join(cfg), shell=True)
+ '--filename="%s" ' % filename,
+ shell=True)
return filename
def process_image(self, filename):
@@ -129,6 +136,7 @@ class PhotoBooth(object):
if __name__ == "__main__":
photobooth = PhotoBooth()
try:
+ photobooth.initialize()
while True:
raw_input("Press enter to capture photo.")
filename = photobooth.capture_photo()