diff --git a/tools/tools-gphoto2.js b/tools/tools-gphoto2.js index a69da9f..a99bd4a 100644 --- a/tools/tools-gphoto2.js +++ b/tools/tools-gphoto2.js @@ -55,16 +55,17 @@ BOB_module.takePicture = function(pBoothId, pPictId, pCallback) { } else { BOB_mod_mkdirp(destPath, function() { BOB_mod_fs.writeFile(pictOrig, pData, function(pErr) { - BOB_mod_gm(pictOrig) - .autoOrient() - .gravity('Center') - // .resize(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height, "^") - // .crop(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height) - // .modulate(100, 0) - // .contrast(+2) - .write(pictOrig, function(pErr) { - return pCallback(pErr, pictPblt) - }) + // BOB_mod_gm(pictOrig) + // .autoOrient() + // .gravity('Center') + // // .resize(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height, "^") + // // .crop(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height) + // // .modulate(100, 0) + // // .contrast(+2) + // .write(pictOrig, function(pErr) { + // return pCallback(pErr, pictPblt) + // }) + return pCallback(pErr, pictOrig) }); }) } diff --git a/views/index.ejs b/views/index.ejs index 731b2a5..1a82971 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -22,9 +22,9 @@
- @@ -70,23 +70,26 @@ socket.on('boothClick', function(pData) { BOB_runBooth(); }); -BOB_var_context = { +var BOB_var_context = { boothOnGoing : false, - initTimer : 3, + initTimer : 6, onGoingTimer : 0, boothId : null, pictureId : 0 } -BOB_var_themes = [ - "le chat", - "le cuir moustache", - "le roi", - "le bouffon", - "le moussailon", - "le geek", - "l'amoureux", -] +var BOB_var_themes = { + selectedId : 0, + list : [ + "le chat", + "le cuir moustache", + "le roi", + "le bouffon", + "le moussailon", + "le geek", + "l'amoureux", + ] +} $(document).ready(function() { $('#idBtnClick').click(function() { @@ -95,30 +98,38 @@ $(document).ready(function() { }) function BOB_runBooth() { - if( BOB_var_context.boothOnGoing === false ) { var currentDate = new Date(); BOB_var_context.boothOnGoing = true; BOB_var_context.boothId = currentDate.getTime(); BOB_var_context.pictureId = 0; BOB_var_context.onGoingTimer = BOB_var_context.initTimer; + $('#idViewTrigger').fadeOut(500, function() { BOB_countdown(); }); } - } function BOB_countdown() { $('#idViewCountdown').fadeIn(); $('#idViewCountdown').html(BOB_var_context.onGoingTimer); + // + if( BOB_var_context.onGoingTimer > 5 ) { + // $('#idViewDoIt').show(); + // $('#idViewDoIt-theme').hide(); + } else if( BOB_var_context.onGoingTimer > 2 ) { + // $('#idViewDoIt-theme').html( BOB_var_themes.list[BOB_var_themes.selectedId] ); + // $('#idViewDoIt-theme').show(); + } + if( BOB_var_context.onGoingTimer > 0 ) { setTimeout(function() { BOB_var_context.onGoingTimer -= 1; BOB_countdown(); }, 1000) } else { - $('#idViewCountdown').html("Smile :-)"); + $('#idViewCountdown').html("Smile"); BOB_takeThe1Pictures(); } } @@ -139,9 +150,21 @@ function BOB_displayPictPreview(pBoothId, pPictureId, pCallback) { function BOB_takeThe1Pictures() { $.get('/dslr/takepicture/'+BOB_var_context.boothId+'/'+BOB_var_context.pictureId, function(pResponse) { - console.log(pResponse); + if( pResponse.error ) { + if( confirm(pResponse.error) ) { + BOB_var_context.boothOnGoing = false; + $('#idViewCountdown').fadeOut(500, function() { + $('#idViewTrigger').fadeIn(); + }); + return; + } + } + // $('#idViewDoIt').hide(); + // $('#idViewDoIt-theme').hide(); + + // BOB_var_themes.selectedId++; - BOB_displayPictPreview(BOB_var_context.boothId, BOB_var_context.pictureId, function() { + // BOB_displayPictPreview(BOB_var_context.boothId, BOB_var_context.pictureId, function() { BOB_var_context.pictureId += 1; if( BOB_var_context.pictureId < 4 ) { BOB_var_context.onGoingTimer = BOB_var_context.initTimer; @@ -153,7 +176,7 @@ function BOB_takeThe1Pictures() { $('#idViewTrigger').fadeIn(); }); } - }) + // }) }) }