Allow second argument to define frame to start on

This commit is contained in:
Matt McWilliams 2021-08-10 19:01:45 -04:00
parent 6349010c51
commit adc8b899ed
1 changed files with 23 additions and 15 deletions

34
loop.sh
View File

@ -2,26 +2,33 @@
#field guide #field guide
name=`basename "${1}"` if [ "${2}" == "" ]; then
bash position.sh set name=`basename "${1}"`
ax guides/guide_all.svg bash position.sh set
number=`mktemp`.svg ax guides/guide_all.svg
node ./numbers/ -n "${name}" -o "${number}" number=`mktemp`.svg
ax "${number}" node ./numbers/ -n "${name}" -o "${number}"
rm -f "${number}" ax "${number}"
bash position.sh reset rm -f "${number}"
bash position.sh reset
echo "Are you ready to continue? (yes/no)" echo "Are you ready to continue? (yes/no)"
read input read input
if [ "$input" != "n" ] && [ "$input" != "no" ] if [ "$input" != "n" ] && [ "$input" != "no" ]
then then
echo "Starting with first frame..." echo "Starting with first frame..."
else else
exit 1 exit 1
fi
fi fi
i=0
#files in dir #files in dir
for svg in "${1}"*.svg ; do for svg in "${1}"*.svg ; do
let "i=i+1"
if [ "${2}" != "" ] && [ "${i}" != "${2}" ]; then
continue
fi
filename=`basename "${svg}"` filename=`basename "${svg}"`
name=`echo "${filename}" | cut -d'.' -f1` name=`echo "${filename}" | cut -d'.' -f1`
num=`echo "${name}" | awk -F'_' '{print $(NF)}'` num=`echo "${name}" | awk -F'_' '{print $(NF)}'`
@ -30,6 +37,7 @@ for svg in "${1}"*.svg ; do
ax guides/guide_marks.svg ax guides/guide_marks.svg
number=`mktemp`.svg number=`mktemp`.svg
node ./numbers/ -n "${num}" -o "${number}" node ./numbers/ -n "${num}" -o "${number}"
ax "${number}"
ax "${svg}" ax "${svg}"
rm -f "${number}" rm -f "${number}"
bash position.sh reset bash position.sh reset