-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera_manager.py
More file actions
54 lines (44 loc) · 1.6 KB
/
Copy pathcamera_manager.py
File metadata and controls
54 lines (44 loc) · 1.6 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
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
#Manages Sensor Inputs
#Author: Kevin Murphy
#Date : 18 - Oct - 14
import subprocess
import constants as CONSTS
import os
import sys
import signal
import subprocess
import time
class CameraManager(object):
DEBUG = True
LOGTAG = "CameraManager"
@staticmethod
def takeStill():
print "CameraManager :: Taking Still"
# The os.setsid() is passed in the argument preexec_fn so
# it's run after the fork() and before exec() to run the shell.
pro = subprocess.Popen([CONSTS.SCRIPT_TAKE_CAMERA_STILL],
shell=True, preexec_fn=os.setsid)
time.sleep(10)
os.killpg(pro.pid, signal.SIGTERM) # Send the signal to all the process groups
@staticmethod
def recordVideo():
print "CameraManager :: Taking Video"
pro = subprocess.Popen([CONSTS.SCRIPT_TAKE_CAMERA_VIDEO],
shell=True, preexec_fn=os.setsid)
time.sleep(40)
os.killpg(pro.pid, signal.SIGTERM) # Send the signal to all the process groups
@staticmethod
def startStream():
print "CameraManager :: Starting Remote Stream"
pro = subprocess.Popen([CONSTS.SCRIPT_START_REMOTE_STREAM],
shell=True, preexec_fn=os.setsid)
time.sleep(30)
os.killpg(pro.pid, signal.SIGTERM)
@staticmethod
def startLocalStream():
print "CameraManager :: Starting Local Stream"
pro = subprocess.Popen([CONSTS.SCRIPT_START_STREAM],
shell=True, preexec_fn=os.setsid)
time.sleep(30)
os.killpg(pro.pid, signal.SIGTERM)