#!/bin/bash

# capture n°080530
#

###################################
#
###################################
# exemple ./hugin_bash.sh 36077 36159

function batch_exif_photos {
#  this is a WIP

    local gopro_subfolder=$1


    echo " création des assemblages pour le dossier $gopro_subfolder"

    archive_zfs="/home/poule/encrypted/stockage-syncable"
    node_script_hugin_folder="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion"

    pto_folder="$archive_zfs/www/development/html/scripts/hugin-gopro-fusion/output_pto/"
    destination_pto="$archive_zfs/photos/imageries/gopro/INBOX_PTO_hugin"
    # test de l'existence des dossiers
    if [ -f "$archive_zfs" ] ; then
      echo "zfs archive is not mounted"
      exit 1
    fi

    if [ -f "$destination_pto" ] ; then
      mkdir -p "$archive_zfs/photos/imageries/gopro/INBOX_PTO_hugin"
    fi

    cd "$destination_pto"
    echo "création de hugin_executor"
    echo " -> ts-node ${node_script_hugin_folder}/main.ts --goproSubFolder="${gopro_subfolder}" --previous_zero=''"
    ts-node $node_script_hugin_folder/main.ts --goproSubFolder="$gopro_subfolder" --previous_zero=''


#    echo "lancement de hugin_executor_from_${min}_to_${max}.sh"
#    echo " -> bash hugin_executor_from_${min}_to_${max}.sh"
#    echo "lancement de l'ajout d'infos GPS aux photos assemblées"
#    echo " -> bash exif_batch ${min} ${max} ${gopro_subfolder}"

}

batch_exif_photos $1