up main for testing photos

This commit is contained in:
Tykayn 2023-08-29 13:56:27 +02:00 committed by tykayn
parent a35fcce99b
commit 7293f14ad5
1 changed files with 41 additions and 22 deletions

View File

@ -14,11 +14,11 @@ const moment = require("moment");
// configs // 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 absolutePath = "/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/img";
let folder = "~/www/scripts/hugin-gopro-fusion/img" let folder = "/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/img/"
let subFolder = "essai" let subFolder = "essai/"
let mini_arguments: any = minimist(process.argv.slice(2)) let mini_arguments: any = minimist(process.argv.slice(2))
console.log('mini_arguments', mini_arguments) console.log('mini_arguments', mini_arguments)
@ -32,17 +32,35 @@ function findMinMaxNumberOfPhotos(filesList:Array<string>){
max: '080096', max: '080096',
} }
} }
function getGoproFiles(folder: string) { function getGoproFiles(folder: string) {
return fs.readdirSync(folder) console.log('getGoproFiles folder', folder)
return fs.readdirSync('' + folder)
} }
function makeBashScriptHugin(minmax: any) { function makeBashScriptHugin(minmax: any) {
console.log('makeBashScriptHugin')
// in each increment of a pair of photos, build a pto referencing absolute paths // in each increment of a pair of photos, build a pto referencing absolute paths
// write the pto in output // write the pto in output
let currentNumber = '123'; console.log('parseInt(minmax.min)', parseInt(minmax.min))
for (let ii: any = parseInt(minmax.min); ii <= parseInt(
minmax.max
); ii++) {
console.log('make PTO file : ii', ii)
// makePto(absolutePath, ii)
// let currentNumber = ii;
let currentNumber = '080096';
let ptoContent = makePto(absolutePath, currentNumber); let ptoContent = makePto(absolutePath, currentNumber);
writeFile('merging_'+currentNumber, ptoContent) console.log('ptoContent', ptoContent)
writeFile(`merging_${currentNumber}.pto`, ptoContent)
} }
}
function makePto(absolutePath: string, currentNumber: string) { function makePto(absolutePath: string, currentNumber: string) {
let front_picture_name = absolutePath + 'GF' + currentNumber + '.JPG'; let front_picture_name = absolutePath + 'GF' + currentNumber + '.JPG';
@ -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) { function writeFile(fileName: string, fileContent: any) {
console.log('write file', fileName) console.log('write file', fileName)
@ -158,12 +175,14 @@ 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) 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 // run it all
main() main()