From: Hugo Villeneuve Date: Sat, 7 Oct 2023 03:13:13 +0000 (-0400) Subject: Add dry-run option X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=2efdc6f1d99e8b97963a7aa63df0e96a091825d3;p=fgen.git Add dry-run option --- diff --git a/fgen.sh b/fgen.sh index b6a45c2..1e92b1e 100755 --- a/fgen.sh +++ b/fgen.sh @@ -17,6 +17,8 @@ fps=8 debug=0 trames=1 +dry_run=0 + SED=sed FFMPEG_OPTS="-hide_banner -loglevel error -y" @@ -85,11 +87,12 @@ print_usage() echo "Options:" echo " -d affiche les informations de debug" echo " -f ne regénère pas les trames, mais uniquement la séquence vidéo" + echo " -n mode de test (dry-run)" echo " -r nombre de trames par seconde (FPS)" echo " -h affiche ce message d'aide" } -while getopts "dhfr:" flag ;do +while getopts "dhfnr:" flag ;do case ${flag} in d) debug="1" @@ -97,6 +100,9 @@ while getopts "dhfr:" flag ;do f) trames=0 ;; + n) + dry_run=1 + ;; r) fps="${OPTARG}" ;; @@ -190,8 +196,10 @@ if [ ${trames} -eq 1 ]; then if [ x"${ng}" != x"" ]; then if which ffmpeg 1> /dev/null 2>&1; then if [ -f ${dest}/${group}-f1.png ]; then - # Conversion vidéo: - ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 + if [ ${dry_run} -eq 0 ]; then + # Conversion vidéo: + ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 + fi fi fi @@ -227,7 +235,15 @@ if [ ${trames} -eq 1 ]; then fi log_dbg "New frame ID: ${nf}" - convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/${group}-f${nf}.png + + if [ ${dry_run} -eq 1 ]; then + touch ${dest}/${group}-f${nf}.png + else + convert -colorspace sRGB -page +0+0 ${dest}/background.png \ + ${files} -background none -layers merge \ + ${dest}/${group}-f${nf}.png + fi + files="" oldnf="${nf}" fi