From: Hugo Villeneuve Date: Fri, 6 Oct 2023 03:01:39 +0000 (-0400) Subject: Do not record non-seqential frames X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=e94c6ad740fc4fb40ca32ea3e1a95b6bd9a1c73b;p=fgen.git Do not record non-seqential frames --- diff --git a/fgen.sh b/fgen.sh index 07507d7..56b162e 100755 --- a/fgen.sh +++ b/fgen.sh @@ -174,6 +174,8 @@ if [ ${trames} -eq 1 ]; then # Will start at frame 2 at first loop iteration f=1 + nf="" + oldnf="" files="" while read l; do @@ -195,9 +197,23 @@ if [ ${trames} -eq 1 ]; then files="${files} -page ${p} ${src}[${f}]" if [ x"${nf}" != x"" ]; then + # Only check expected frame if oldnf is set... + if [ x"${oldnf}" != x"" ]; then + expected_nf=$((${oldnf} + 1)) + + if [ ${expected_nf} -ne ${nf} ]; then + echo "Error: invalid frame sequence: ${nf}" + echo " previous: ${oldnf}" + echo " expected: ${expected_nf}" + files="" + continue + fi + fi + log_dbg "New frame ID: ${nf}" convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/f${nf}.png files="" + oldnf="${nf}" fi done <${layers} fi