-
Notifications
You must be signed in to change notification settings - Fork 0
/
gphoto_cmd.js
54 lines (34 loc) · 1.2 KB
/
gphoto_cmd.js
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
var captureShot = function(i)
{
// var exec = require('child_process').exec;
// exec('gphoto2 --set-config eosremoterelease=Immediate --wait-event=2s --set-config eosremoterelease="Release Full" --keep --filename camera/'+i+'.%C --wait-event-and-download=3s', function (error, stdout, stderr) {
var spawn = require('child_process').spawn;
var child = spawn('gphoto2', ['--set-config', 'eosremoterelease=Immediate', '--wait-event=1s', '--set-config', 'eosremoterelease=Release Full', '--keep', '--filename', 'camera/'+i+'.%C', '--wait-event-and-download=9']);
//['--set-config', 'eosremoterelease=Immediate', '--wait-event=2s', '--set-config', 'eosremoterelease="Release Full"', '--keep', '--filename camera/'+i+'.%C', '--wait-event-and-download=3s']);
child.stdout.on('data', function (data) {
// console.log('stdout: ' + data);
});
child.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
child.on('close', function (code) {
// console.log('child process exited with code ' + code);
next();
});
};
var next = function()
{
i++;
if (i<=len)
{
captureShot(i);
}
else
{
process.exit();
}
};
var i=0;
var len=30;
next();
process.stdin.resume();