From eeae5331aa1ad3ea96c3c72a5e6200c70d32846f Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Thu, 4 May 2017 22:25:15 +0200 Subject: [PATCH] try to wait til camera image is written --- screenless/bureau/photography/photography.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/screenless/bureau/photography/photography.py b/screenless/bureau/photography/photography.py index 4886996..42d1f7e 100644 --- a/screenless/bureau/photography/photography.py +++ b/screenless/bureau/photography/photography.py @@ -62,24 +62,22 @@ class Photography(Bureau): #cmd1 = "uvccapture -d/dev/video1 -x320 -y240 -o /dev/null" #cmd2 = "/usr/local/bin/uvccapture -m -x3264 -y2448 -o" + tmpimg.name #subprocess.check_output(cmd1.split()) - print(os.getcwd()) modpath = os.path.dirname(__file__) mjpg = os.path.join(modpath, "..", "..", "lib", "mjpg-streamer", "mjpg-streamer-experimental", "mjpg_streamer") mjpg_dir = os.path.dirname(mjpg) cmd = mjpg.split() + ["-i", "'input_uvc.so -r 3264x2448 -n'", "-o", "'output_file.so -f /tmp/webcam -d 500 -s 1'"] - print(cmd) proc = subprocess.Popen(cmd, shell=True, env={"LD_LIBRARY_PATH": mjpg_dir}) + time.sleep(2) + proc.terminate() + time.sleep(1) # copy last image to the tmpfile filelist = os.listdir() newest = max(filelist, key=lambda x: os.stat(x).st_mtime) shutil.copyfile(newest, tmpimg.name) - time.sleep(2) - proc.terminate() - self._doc_light_off() return {"photo": tmpimg.name}