diff --git a/hugin-gopro-fusion/find_min_max.ts b/hugin-gopro-fusion/find_min_max.ts index 221e6aa1..88d1e545 100644 --- a/hugin-gopro-fusion/find_min_max.ts +++ b/hugin-gopro-fusion/find_min_max.ts @@ -58,3 +58,95 @@ bash /home/poule/encrypted/stockage-syncable/photos/imageries/gopro/INBOX_PTO_hu bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh ${result.min} ${result.max} INBOX_a_assembler/${subfolder} `) + +const hugin_assemblages_script_output_path = '/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output'; +const envois_todo_panoramax = '/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/PANORAMAX_envois_todo/'+subfolder; +const startNumber = result.min; +const endNumber = result.max; + +// const startNumber = 1; +// const endNumber = 5; + +function renameFile(fileName: string): void { + const filePath = path.join(hugin_assemblages_script_output_path, fileName); + + if (fs.existsSync(filePath)) { + const newFileName = `assemblage_0${startNumber}.jpg`; + const newFilePath = path.join(envois_todo_panoramax , newFileName); + + console.log('rename: ', filePath , newFilePath) + + + fs.renameSync(filePath, newFilePath); + }else{ + console.log('ce fichier est inexistant', filePath) + } +} + + +function createDirectory(folderName: string): void { + if (!fs.existsSync(folderName)) { + fs.mkdirSync(folderName); + } +} + +function getFileNames(): string[] { + const files = fs.readdirSync(hugin_assemblages_script_output_path); + const fileNames = files.filter((fileName) => { + const regex = /^assemblage_\d+(\.\d+)?\.jpg$/; + return regex.test(fileName); + }); + + return fileNames; +} + + +/** + * déplacer des imageries assemblées en masse dans un dossier "à envoyer" + * @param startNumber + * @param endNumber + */ +function batch_move_assembled_files(startNumber:number,endNumber:number){ + const fileNames = getFileNames(); + + for (let i = startNumber; i <= endNumber; i++) { + const fileName = `assemblage_0${i}.jpg`; + + console.log('fileName', fileName) + // renameFile(fileName); + + } +} + +console.log(' déplacer les assemblages dans '+envois_todo_panoramax, startNumber, endNumber) + +createDirectory(envois_todo_panoramax); +batch_move_assembled_files(startNumber,endNumber) + + +import * as childProcess from 'child_process'; + +function executeCommand(command: string, folderName: string): void { + const fullCommand = `${command} "${folderName}"`; + + childProcess.exec(fullCommand, (error, stdout, stderr) => { + if (error) { + console.error(`Error executing command: ${fullCommand}`); + console.error(error); + } else { + console.log(`Output of command: ${fullCommand}`); + console.log(stdout); + } + }); +} + +function exec_geovisio(envois_todo_panoramax:string): void { + const folderName = envois_todo_panoramax; + const command = 'geovisio upload --api-url https://panoramax.openstreetmap.fr'; + + executeCommand(command, folderName); +} + +exec_geovisio(envois_todo_panoramax); + +console.log("exécuter geovisio upload") \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 10dddf71..7815aed5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,6 +6,8 @@ "": { "name": "scripts-tykayn", "dependencies": { + "csv-parse": "^5.5.2", + "csv-parser": "^3.0.0", "exifr": "^7.1.3", "fs": "^0.0.1-security", "minimist": "^1.2.8", @@ -27,6 +29,9 @@ "jest": "^29.5.0", "nodemon": "^2.0.22", "ts-node": "^10.9.1" + }, + "engines": { + "node": "^18" } }, "node_modules/@ampproject/remapping": { @@ -3159,6 +3164,25 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/csv-parse": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.2.tgz", + "integrity": "sha512-YRVtvdtUNXZCMyK5zd5Wty1W6dNTpGKdqQd4EQ8tl/c6KW1aMBB1Kg1ppky5FONKmEqGJ/8WjLlTNLPne4ioVA==" + }, + "node_modules/csv-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", + "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "csv-parser": "bin/csv-parser" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -8132,6 +8156,19 @@ "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true }, + "csv-parse": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.2.tgz", + "integrity": "sha512-YRVtvdtUNXZCMyK5zd5Wty1W6dNTpGKdqQd4EQ8tl/c6KW1aMBB1Kg1ppky5FONKmEqGJ/8WjLlTNLPne4ioVA==" + }, + "csv-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", + "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", + "requires": { + "minimist": "^1.2.0" + } + }, "debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",