|
|
@ -11,8 +11,18 @@ var CFG = require('../config') |
|
|
|
|
|
|
|
|
let tools = {} |
|
|
let tools = {} |
|
|
|
|
|
|
|
|
function execGphoto2 (pArgs, pCallback) { |
|
|
|
|
|
exec(`gphoto2 ${pArgs}`, function (pErr, pStdout, pStderr) { |
|
|
|
|
|
|
|
|
function execGphoto2 (pArgs, pMore, pCallback) { |
|
|
|
|
|
let args, more, callback |
|
|
|
|
|
if (pCallback) { |
|
|
|
|
|
args = pArgs |
|
|
|
|
|
more = pMore |
|
|
|
|
|
callback = pCallback |
|
|
|
|
|
} else { |
|
|
|
|
|
args = pArgs |
|
|
|
|
|
more = {} |
|
|
|
|
|
callback = pMore |
|
|
|
|
|
} |
|
|
|
|
|
exec(`gphoto2 ${args}`, more, function (pErr, pStdout, pStderr) { |
|
|
if (pErr) { |
|
|
if (pErr) { |
|
|
console.log(`[!] Please install gphoto2`.red) |
|
|
console.log(`[!] Please install gphoto2`.red) |
|
|
console.log(`sudo apt-get install gphoto2`.bgMagenta) |
|
|
console.log(`sudo apt-get install gphoto2`.bgMagenta) |
|
|
@ -30,7 +40,7 @@ function execGphoto2 (pArgs, pCallback) { |
|
|
if (pStdout) { |
|
|
if (pStdout) { |
|
|
outInLines = splitLines(pStdout) |
|
|
outInLines = splitLines(pStdout) |
|
|
} |
|
|
} |
|
|
pCallback(error, outInLines) |
|
|
|
|
|
|
|
|
callback(error, outInLines) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -63,7 +73,9 @@ tools.checkCameraConnection = function (pCb) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tools.__takeOnePicture = function (pPath, pCb) { |
|
|
tools.__takeOnePicture = function (pPath, pCb) { |
|
|
execGphoto2(`--capture-image-and-download --filename=${pPath} --force-overwrite`, pCb) |
|
|
|
|
|
|
|
|
let lPath = path.parse(pPath) |
|
|
|
|
|
console.log(lPath) |
|
|
|
|
|
execGphoto2(`--capture-image-and-download --filename=${lPath.base} --force-overwrite`, {cwd: lPath.dir}, pCb) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tools.takeOnePicture = function (pBoothId, pPictId, pCallback) { |
|
|
tools.takeOnePicture = function (pBoothId, pPictId, pCallback) { |
|
|
|