From 9e853e0b6ed6e45bef3ae7266a3dee45cd09ffed Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 10 Feb 2024 12:38:38 +0100 Subject: [PATCH] make a batch move to a place to orient photos --- hugin-gopro-fusion/exif_batch.sh | 17 ++++++++++++++++- hugin-gopro-fusion/main.ts | 2 +- hugin-gopro-fusion/move_batch.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 hugin-gopro-fusion/move_batch.sh diff --git a/hugin-gopro-fusion/exif_batch.sh b/hugin-gopro-fusion/exif_batch.sh index b013aae4..3a9f000b 100755 --- a/hugin-gopro-fusion/exif_batch.sh +++ b/hugin-gopro-fusion/exif_batch.sh @@ -25,8 +25,14 @@ function batch_exif_photos { for i in $(seq $min $max); do filename=$i + filename_with_zero="0$i" + file="$dir/GF$filename.JPG" - file_assemblage="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_0$i.jpg" + file_with_zero="$dir/GF$filename_with_zero.JPG" + + file_assemblage="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_$i.jpg" + + file_assemblage_with_zero="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_0$i.jpg" if [ -f "$file" ] && [ -f "$file_assemblage" ]; then echo "set the tags in assemblage $i from GF$filename.jpg" @@ -35,6 +41,15 @@ function batch_exif_photos { else echo "batch_exif_photos: File $file does not exist." fi + + # test with previous zero + if [ -f "$file_with_zero" ] && [ -f "$file_assemblage_with_zero" ]; then + echo "set the tags in assemblage $i from GF$filename_with_zero.jpg" + exiftool -tagsFromFile "$file_with_zero" $file_with_zero $file_assemblage_with_zero -overwrite_original + echo "updated the exift tags of $file_assemblage_with_zero" + else + echo "batch_exif_photos: File $file_with_zero does not exist." + fi done echo "# fin des assemblages exif" diff --git a/hugin-gopro-fusion/main.ts b/hugin-gopro-fusion/main.ts index 52653178..44e5dee9 100644 --- a/hugin-gopro-fusion/main.ts +++ b/hugin-gopro-fusion/main.ts @@ -35,7 +35,7 @@ if (mini_arguments['addExifToolInScript']) { addExifToolInScript = mini_arguments['addExifToolInScript'] } if (mini_arguments['previous_zero']) { - previous_zero = mini_arguments['previous_zero'] + previous_zero = '0' } if (mini_arguments['goproMin']) { goproMin = mini_arguments['goproMin'] diff --git a/hugin-gopro-fusion/move_batch.sh b/hugin-gopro-fusion/move_batch.sh new file mode 100755 index 00000000..924b56c5 --- /dev/null +++ b/hugin-gopro-fusion/move_batch.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# déplacer en masse des photos assemblées dans le dossier /home/poule/encrypted/stockage-syncable/photos/imageries/gopro/A_ORIENTER + +# Argument validation +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +start_num="$1" +end_num="$2" +src_base_name="assemblage_" +new_folder="from_$start_num" + +# Créer un nouveau dossier dans dst_dir +dst_dir="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/A_ORIENTER/${new_folder}_to_$(printf '%03d\n' "$end_num")" +mkdir -p "${dst_dir}" + +# Déplacer des fichiers depuis le répertoire actuel vers le nouveau dossier +for i in $(seq -f "%03g" ${start_num} ${end_num}); do + src_file="${src_base_name}${i}.jpg" + dst_file="${dst_dir}/${src_file}" + + if [ -f "/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/${src_file}" ]; then + mv -- "/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/${src_file}" "${dst_file}" + echo "Déplacé ${src_file} -> ${dst_file}" + else + echo "Fichier '${src_file}' introuvable." + fi +done