|
|
|
@ -49,28 +49,34 @@ function execGphoto2 (pArgs, pMore, pCallback) { |
|
|
|
tools.checkVersion = function (pCb) { |
|
|
|
console.log('[-] Checking gphoto2 installation...'.bgBlue) |
|
|
|
execGphoto2('--version', function (pErr, pStdout) { |
|
|
|
console.log(`OK: ${pStdout[0]}`.green) |
|
|
|
pCb() |
|
|
|
if (pErr) { |
|
|
|
console.log(`KO`.red) |
|
|
|
} else { |
|
|
|
console.log(`OK: ${pStdout[0]}`.green) |
|
|
|
} |
|
|
|
pCb(pErr) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
tools.checkCameraConnection = function (pCb) { |
|
|
|
console.log('[-] Checking camera connection...'.bgBlue) |
|
|
|
execGphoto2('--auto-detect', function (pErr, pStdout) { |
|
|
|
let device = pStdout[2] |
|
|
|
if (!device) { |
|
|
|
let device = pStdout && pStdout.length ? pStdout[2] : null |
|
|
|
if (pErr || !device) { |
|
|
|
console.log(`[!] Camera not connected`.red) |
|
|
|
console.log('1. Connect camera via USB'.bgMagenta) |
|
|
|
console.log('2. Turn on the camera'.bgMagenta) |
|
|
|
console.log('3. Maybe - Force manual focus on camera'.bgMagenta) |
|
|
|
console.log(`\n\n[-] Bobinoscope will close in 10 seconds...`) |
|
|
|
setTimeout(function () { |
|
|
|
process.exit(1) |
|
|
|
}, 10000) |
|
|
|
return |
|
|
|
pCb(pErr || 'CameraNotFound') |
|
|
|
// console.log(`\n\n[-] Bobinoscope will close in 10 seconds...`)
|
|
|
|
// setTimeout(function () {
|
|
|
|
// process.exit(1)
|
|
|
|
// }, 10000)
|
|
|
|
// return
|
|
|
|
} else { |
|
|
|
console.log(`OK: ${device}`.green) |
|
|
|
pCb() |
|
|
|
} |
|
|
|
console.log(`OK: ${device}`.green) |
|
|
|
pCb() |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@ -123,7 +129,16 @@ tools.init = function (pCb) { |
|
|
|
// })
|
|
|
|
}) |
|
|
|
|
|
|
|
async.waterfall(tasks, pCb) |
|
|
|
async.waterfall(tasks, function (pErr) { |
|
|
|
if (pErr) { |
|
|
|
console.log('[!] Bobinoscope init failed... Retry in 10 seconds'.red) |
|
|
|
setTimeout(function () { |
|
|
|
tools.init(pCb) |
|
|
|
}, 10000) |
|
|
|
} else { |
|
|
|
pCb() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = tools |