detect saut de séquence
This commit is contained in:
parent
e0dcf24ab3
commit
0d7a847ecd
@ -3,9 +3,14 @@ import path from "path";
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import minimist from 'minimist';
|
import minimist from 'minimist';
|
||||||
|
import * as childProcess from 'child_process';
|
||||||
|
|
||||||
let mini_arguments: any = minimist(process.argv.slice(2))
|
let mini_arguments: any = minimist(process.argv.slice(2))
|
||||||
|
|
||||||
|
let enable_batch_move_assembled_files = false;
|
||||||
|
|
||||||
|
let should_exec_geovisio_upload = false;
|
||||||
|
|
||||||
let folder = `/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/INBOX_a_assembler/`
|
let folder = `/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/INBOX_a_assembler/`
|
||||||
let subfolder = ``
|
let subfolder = ``
|
||||||
|
|
||||||
@ -24,15 +29,21 @@ function findMinMaxNumberOfPhotos(dirPath: string): { min: number, max: number }
|
|||||||
let minNumber: number = 0;
|
let minNumber: number = 0;
|
||||||
let maxNumber: number = 0;
|
let maxNumber: number = 0;
|
||||||
|
|
||||||
|
let previousFileName = 0
|
||||||
// Boucler sur chaque fichier JPG dans le dossier
|
// Boucler sur chaque fichier JPG dans le dossier
|
||||||
fs.readdirSync(dirPath).forEach(file => {
|
fs.readdirSync(dirPath).forEach(file => {
|
||||||
|
|
||||||
|
let currentFileName = path.extname(file)
|
||||||
// Vérifier si le fichier est un fichier JPG
|
// Vérifier si le fichier est un fichier JPG
|
||||||
if (path.extname(file) === '.jpg' || path.extname(file) === '.JPG') {
|
if (currentFileName === '.jpg' || currentFileName === '.JPG') {
|
||||||
// Éxtraire le nombre du nom de fichier
|
// Éxtraire le nombre du nom de fichier
|
||||||
let matches: any = file.match(/(\d+)/);
|
let matches: any = file.match(/(\d+)/);
|
||||||
if (matches && matches.length && matches[0]) {
|
if (matches && matches.length && matches[0]) {
|
||||||
let number = parseInt(matches[0]);
|
let number = parseInt(matches[0]);
|
||||||
|
|
||||||
|
if (previousFileName + 1 !== number) {
|
||||||
|
console.log('saut de nombre / séquence à ', previousFileName, number)
|
||||||
|
}
|
||||||
// Sauver le nombre minimal et maximal trouvé jusqu'à présent
|
// Sauver le nombre minimal et maximal trouvé jusqu'à présent
|
||||||
if (minNumber === 0 && number > 0) {
|
if (minNumber === 0 && number > 0) {
|
||||||
minNumber = number;
|
minNumber = number;
|
||||||
@ -40,6 +51,8 @@ function findMinMaxNumberOfPhotos(dirPath: string): { min: number, max: number }
|
|||||||
if (number > maxNumber) {
|
if (number > maxNumber) {
|
||||||
maxNumber = number;
|
maxNumber = number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousFileName = number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -85,6 +98,7 @@ function renameFile(fileName: string): void {
|
|||||||
|
|
||||||
|
|
||||||
function createDirectory(folderName: string): void {
|
function createDirectory(folderName: string): void {
|
||||||
|
console.log('createDirectory', folderName)
|
||||||
if (!fs.existsSync(folderName)) {
|
if (!fs.existsSync(folderName)) {
|
||||||
fs.mkdirSync(folderName);
|
fs.mkdirSync(folderName);
|
||||||
}
|
}
|
||||||
@ -108,12 +122,13 @@ function getFileNames(): string[] {
|
|||||||
*/
|
*/
|
||||||
function batch_move_assembled_files(startNumber: number, endNumber: number) {
|
function batch_move_assembled_files(startNumber: number, endNumber: number) {
|
||||||
const fileNames = getFileNames();
|
const fileNames = getFileNames();
|
||||||
|
console.log('fileNames', fileNames)
|
||||||
|
|
||||||
for (let i = startNumber; i <= endNumber; i++) {
|
for (let i = startNumber; i <= endNumber; i++) {
|
||||||
const fileName = `assemblage_0${i}.jpg`;
|
const fileName = `assemblage_0${i}.jpg`;
|
||||||
|
|
||||||
console.log('fileName', fileName)
|
console.log('fileName', fileName)
|
||||||
// renameFile(fileName);
|
renameFile(fileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,11 +136,13 @@ function batch_move_assembled_files(startNumber:number,endNumber:number){
|
|||||||
console.log(' déplacer les assemblages dans ' + envois_todo_panoramax, startNumber, endNumber)
|
console.log(' déplacer les assemblages dans ' + envois_todo_panoramax, startNumber, endNumber)
|
||||||
|
|
||||||
createDirectory(envois_todo_panoramax);
|
createDirectory(envois_todo_panoramax);
|
||||||
|
|
||||||
|
if (enable_batch_move_assembled_files) {
|
||||||
|
|
||||||
batch_move_assembled_files(startNumber, endNumber)
|
batch_move_assembled_files(startNumber, endNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
import * as childProcess from 'child_process';
|
|
||||||
|
|
||||||
function executeCommand(command: string, folderName: string): void {
|
function executeCommand(command: string, folderName: string): void {
|
||||||
const fullCommand = `${command} "${folderName}"`;
|
const fullCommand = `${command} "${folderName}"`;
|
||||||
|
|
||||||
@ -147,6 +164,10 @@ function exec_geovisio(envois_todo_panoramax:string): void {
|
|||||||
executeCommand(command, folderName);
|
executeCommand(command, folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (should_exec_geovisio_upload) {
|
||||||
exec_geovisio(envois_todo_panoramax);
|
exec_geovisio(envois_todo_panoramax);
|
||||||
|
} else {
|
||||||
|
console.log(' l envoi vers geovisio automatique est désactivé ')
|
||||||
|
}
|
||||||
|
|
||||||
console.log("exécuter geovisio upload")
|
console.log("exécuter geovisio upload")
|
@ -3,7 +3,8 @@
|
|||||||
conversion de données exif
|
conversion de données exif
|
||||||
|
|
||||||
Utilisation:
|
Utilisation:
|
||||||
ts-node main.ts --goproMin=80800 --goproMax=80801 --goproSubFolder="rouen_oct23"
|
|
||||||
|
ts-node main.ts --goproMin=54903 --goproMax=56267 --goproSubFolder="INBOX_a_assembler/camaret1"
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -46,8 +47,6 @@ if (mini_arguments['goproMax']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let hugin_batch_command = 'bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh ' + goproMin + ' ' + goproMax
|
|
||||||
|
|
||||||
|
|
||||||
let extension_photo_source = 'jpg'
|
let extension_photo_source = 'jpg'
|
||||||
extension_photo_source = 'JPG'
|
extension_photo_source = 'JPG'
|
||||||
@ -155,10 +154,16 @@ function makeBashScriptHugin(minmax: any) {
|
|||||||
|
|
||||||
// console.log('ptoContent', ptoContent)
|
// console.log('ptoContent', ptoContent)
|
||||||
writeFile(ptoFileName, ptoContent)
|
writeFile(ptoFileName, ptoContent)
|
||||||
|
}else{
|
||||||
|
console.log('l écriture de fichiers PTO a été désactivée')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hugin_batch_command = 'bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh ' + goproMin + ' ' + goproMax
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (addExifToolInScript) {
|
if (addExifToolInScript) {
|
||||||
scriptsContent += '\n # complétion des données gps depuis une des photos assemblées' +
|
scriptsContent += '\n # complétion des données gps depuis une des photos assemblées' +
|
||||||
'\n' + hugin_batch_command + '\n'
|
'\n' + hugin_batch_command + '\n'
|
||||||
|
Loading…
Reference in New Issue
Block a user