Browse Source

show message on error / reset after 3 errors

master
P.BARRY 6 years ago
parent
commit
c2d5d1bccb
2 changed files with 33 additions and 11 deletions
  1. 30
      server/views/scope.ejs
  2. 14
      tools/tools-gphoto2.js

30
server/views/scope.ejs

@ -97,6 +97,7 @@
initTimer : 3,
onGoingTimer : 0,
boothId : null,
nbError : 0,
pictureId : 0
}
@ -184,6 +185,24 @@
}, 500)
}
function BOB_showError () {
BOB_var_context.nbError += 1
$('#idViewCountdown').fadeIn()
$('#idViewCountdown').css('fontSize', '3em')
if (BOB_var_context.nbError >= 3) {
BOB_var_context.nbError = 0
$('#idViewCountdown').html("Oulala, le bobinoscope se sent pas<br/>très bien<br/>Revenez plus tard !")
setTimeout(function () {
$('#idViewCountdown').fadeOut(500, function() {
$('#idViewTrigger').fadeIn();
})
}, 5000)
} else {
$('#idViewCountdown').html("Oops ! Un problème de pellicule ...<br/>On recommence")
BOB_var_context.onGoingTimer = BOB_var_context.initTimer
setTimeout(BOB_countdown, 4000)
}
}
function BOB_takeThe1Pictures() {
$.get('/booth/dslr/takepicture/'+BOB_var_context.boothId+'/'+BOB_var_context.pictureId, function(pResponse) {
@ -195,14 +214,15 @@
// });
// return;
// }
$('#idViewCountdown').html("Oops ! Un problème de pellicule<br/>On Recommence !!!");
$('#idViewCountdown').css('fontSize', '14em')
} else {
BOB_var_context.pictureId += 1
BOB_showError()
return
}
BOB_var_context.pictureId += 1
BOB_var_context.nbError = 0
if( BOB_var_context.pictureId < 4 ) {
BOB_var_context.onGoingTimer = BOB_var_context.initTimer;
BOB_var_context.onGoingTimer = BOB_var_context.initTimer
BOB_countdown();
} else {
$('#idViewCountdown').fadeOut(500, function() {

14
tools/tools-gphoto2.js

@ -24,12 +24,14 @@ function execGphoto2 (pArgs, pMore, pCallback) {
}
exec(`gphoto2 ${args}`, more, function (pErr, pStdout, pStderr) {
if (pErr) {
console.log(`[!] Please install gphoto2`.red)
console.log(`sudo apt-get install gphoto2`.bgMagenta)
console.log(`[-] Bobinoscope will close in 10 seconds...`)
setTimeout(function () {
process.exit(1)
}, 10000)
// console.log(`[!] Please install gphoto2`.red)
// console.log(`sudo apt-get install gphoto2`.bgMagenta)
// console.log(`[-] Bobinoscope will close in 10 seconds...`)
// console.log('[!]', pErr)
callback(pErr)
// setTimeout(function () {
// process.exit(1)
// }, 10000)
return
}
let error = null

Loading…
Cancel
Save