-
Notifications
You must be signed in to change notification settings - Fork 37
/
videomod.py
executable file
·50 lines (32 loc) · 1.19 KB
/
videomod.py
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
from __future__ import print_function
import time
from time import sleep
import datetime
import os
import sys
from subprocess import Popen, PIPE
def StartServerTimer(lasttime):
shottaken=False
currentdate=datetime.datetime.now().strftime("%y-%m-%d-%H:%M")
print("Current date and time: " , currentdate)
myproc = Popen('mjpg_streamer -i "/usr/lib/input_uvc.so -d /dev/video0 -r 320x240 -f 15" -o "/usr/lib/output_http.so -p 8090 -w /usr/www"', shell=True, stdout=PIPE, stderr=PIPE)
#sleep(10)
print(myproc.stdout.readline())
print('Return code was ', myproc.returncode)
sleep(2)
return shottaken
def StopServerTimer(lasttime):
shottaken=False
currentdate=datetime.datetime.now().strftime("%y-%m-%d-%H:%M")
print("Current date and time: " , currentdate)
myproc = Popen('killall mjpg_streamer', shell=True, stdout=PIPE, stderr=PIPE)
#sleep(10)
print(myproc.stdout.readline())
print('Return code was ', myproc.returncode)
sleep(2)
return shottaken
if __name__ == '__main__':
"""
prova funzioni di video
"""
StartServerTimer(10)