try to wait til camera image is written

workspace
Brendan Howell 8 years ago
parent bad4c9ee18
commit eeae5331aa

@ -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}

Loading…
Cancel
Save