gphoto2 を使用して USB 接続カメラから写真を撮り、feh を使用して写真を表示する単純な python スクリプトを作成しています。
プログラムを実行すると、gphoto2 が写真をキャプチャし、feh がそれを開きますが、画像ウィンドウを手動で閉じることなく、コマンド ラインに戻って別の写真を撮りたいと思います。
画像ウィンドウを閉じることなく、コマンドラインからプログラムを継続的に実行できる方法はありますか?
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..."