I'm creating a simple python script that uses gphoto2 to take a photo from my usb connected camera and feh to display the photo.
When I run program, gphoto2 will capture the photo and feh will open it but I would like to return to the command line to take another photo without having to manually close the image window.
Is there someway I can run the program from the command line continually without have to close the image window?
class PhotoBooth(object):
def capture_photo(self):
filename = join(out, '%s.jpg' % str(uuid4()))
subprocess.call('gphoto2 --capture-image-and-download --filename="%s"' % filename, shell=True)
return filename
def print_photo(self, filename):
subprocess.Popen('feh --g 640x480 ' + filename, shell=True)
photobooth = PhotoBooth()
try:
while True:
raw_input("Press enter to capture photo")
filename = photobooth.capture_photo()
photobooth.print_photo(filename)
except KeyboardInterrupt:
print "\nExiting..."