-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecorder.php
executable file
·59 lines (47 loc) · 1.31 KB
/
recorder.php
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
53
54
55
56
57
58
59
#!/usr/bin/php -q
<?php
include 'filesystem.php';
include 'functions_cams.php';
$cams_str = $argv[1];
$interval = $argv[2]*1000;
$mask = $argv[3];
$root_path = $argv[4];
$subfolder = $argv[5];
$file_limit = $argv[6];
$index = $argv[7];
$cams = array();
$master = array();
$cams = get_cams($cams_str);
$master = get_master($cams);
/*
if ($mask=="0x1ff") $skip = false;
else $skip = true;
*/
$skip = false;
$odd = true;
while(true) {
$time1 = microtime(true);
//trigger
if ($skip) {
//fopen("http://192.168.0.$ip:8081/trig/pointers");
//usleep($interval/2);
//$odd = !$odd;
}
file_get_contents("http://{$master['ip']}:{$master['port']}/trig/pointers");
//usleep(1000);
if ($odd) {
$index = update_subsubdir("$root_path/$subfolder",$index,$file_limit,$index_max=100000);
$path = "$root_path/$subfolder/$index";
//system("./images.sh $ip $n $path &");
for($i=0;$i<count($cams);$i++){
system("./get_image.sh \"{$cams[$i]['ip']}:{$cams[$i]['port']}/bimg\" \"${path}\" \"${i}.jp4\" \"${i}.log\" \"${i}\">/dev/null 2>&1 &");
}
}
$time2 = microtime(true);
$time3 = 1000000*($time2-$time1);
//echo $time2." - ".$time1." = ".$time3."\n";
$delta = $interval-$time3;
if ($delta<0) $delta=0;
usleep($delta);
}
?>