diff --git a/hugin-gopro-fusion/main.ts b/hugin-gopro-fusion/main.ts index fd66016f..505ed90a 100644 --- a/hugin-gopro-fusion/main.ts +++ b/hugin-gopro-fusion/main.ts @@ -14,11 +14,11 @@ const moment = require("moment"); // configs -let dossier_pto_output = "~/www/scripts/hugin-gopro-fusion/output_pto"; +let dossier_pto_output = "/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/output_pto"; -let absolutePath = "/home/cipherbliss/www/scripts/hugin-gopro-fusion/img"; -let folder = "~/www/scripts/hugin-gopro-fusion/img" -let subFolder = "essai" +let absolutePath = "/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/img"; +let folder = "/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/img/" +let subFolder = "essai/" let mini_arguments: any = minimist(process.argv.slice(2)) console.log('mini_arguments', mini_arguments) @@ -26,27 +26,45 @@ if (mini_arguments['folder']) { folder = mini_arguments['folder'] } -function findMinMaxNumberOfPhotos(filesList:Array){ +function findMinMaxNumberOfPhotos(filesList: Array) { return { min: '080096', max: '080096', } } -function getGoproFiles(folder:string){ - return fs.readdirSync(folder) -} -function makeBashScriptHugin(minmax:any){ +function getGoproFiles(folder: string) { + console.log('getGoproFiles folder', folder) + return fs.readdirSync('' + folder) +} + +function makeBashScriptHugin(minmax: any) { + + console.log('makeBashScriptHugin') // in each increment of a pair of photos, build a pto referencing absolute paths // write the pto in output - let currentNumber = '123'; - let ptoContent = makePto(absolutePath, currentNumber); - writeFile('merging_'+currentNumber, ptoContent) -} -function makePto(absolutePath:string,currentNumber:string ){ + console.log('parseInt(minmax.min)', parseInt(minmax.min)) + for (let ii: any = parseInt(minmax.min); ii <= parseInt( + minmax.max + ); ii++) { - let front_picture_name = absolutePath+'GF'+currentNumber+'.JPG'; - let back_picture_name = absolutePath+'GB'+currentNumber+'.JPG'; + console.log('make PTO file : ii', ii) + // makePto(absolutePath, ii) + // let currentNumber = ii; + let currentNumber = '080096'; + let ptoContent = makePto(absolutePath, currentNumber); + console.log('ptoContent', ptoContent) + writeFile(`merging_${currentNumber}.pto`, ptoContent) + + } + + +} + +function makePto(absolutePath: string, currentNumber: string) { + + let front_picture_name = absolutePath + 'GF' + currentNumber + '.JPG'; + let back_picture_name = absolutePath + 'GB' + currentNumber + '.JPG'; console.log('front_picture_name', front_picture_name) @@ -139,7 +157,6 @@ k i1 t1 p"252 628 484 351 745 156 1008 41 1121 2 1992 4 2289 127 2571 317 2769 5 } - function writeFile(fileName: string, fileContent: any) { console.log('write file', fileName) @@ -155,15 +172,17 @@ function writeFile(fileName: string, fileContent: any) { ) } -function main(){ +function main() { - let filesOfFolder = getGoproFiles(folder+subFolder) + let filesOfFolder = getGoproFiles(folder + subFolder) + console.log('filesOfFolder', filesOfFolder) let minmax = findMinMaxNumberOfPhotos(filesOfFolder) - for (let ii = minmax.min; ii < minmax.max; ii++){ + console.log('minmax', minmax) + makeBashScriptHugin(minmax) + - makePto(absolutePath, ii) - } } + // run it all main()