-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera_test.py
More file actions
43 lines (34 loc) · 1.51 KB
/
camera_test.py
File metadata and controls
43 lines (34 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from datetime import datetime
import time
import subprocess
from subprocess import CalledProcessError
#https://askubuntu.com/questions/106770/take-a-picture-from-terminal
#fswebcam -d /dev/video1 -r 640x480 --jpeg 85 -D 1 -S 20 --rotate -90 web-cam-shot.jpg
args = ['fswebcam', '-d', '/dev/video1', '-r', '640x480', '--jpeg', '85', '-S', '20', '--rotate', '-90', 'photos/pic1.jpg']
#args2 = ['fswebcam', '-d', '/dev/video1', '-r', '640x480', '--jpeg', '85', '--rotate', '-90', 'photos/pic2.jpg']
try:
d = datetime.now()
fname1 = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + '.jpg'
args[-1] = 'photos/' + fname1
subprocess.check_output(args, stderr=subprocess.STDOUT)
print datetime.now()
time.sleep(4)
fname1 = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + '.jpg'
args[-1] = 'photos/' + fname1
subprocess.check_output(args, stderr=subprocess.STDOUT)
time.sleep(4)
fname1 = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + '.jpg'
args[-1] = 'photos/' + fname1
subprocess.check_output(args, stderr=subprocess.STDOUT)
print datetime.now()
except CalledProcessError as e:
#print '!!! returncode: ', e.returncode
#print '!!! output: ', e.output
#print '!!! cmd: ', e.cmd
#log_msg = 'cmd: %s\n-----\nreturncode: %s\n-----\noutput: %s' % (e.cmd, e.returncode, e.output)
#self.save_problematic_audio(fromFile, toFile, manifestFile, log_msg)
raise
except Exception as e:
#self.save_problematic_audio(fromFile, toFile, manifestFile, e.message)
raise