Work: add shellcheck config (not working rn). Re-organize stipple script to be more flexible

This commit is contained in:
Matt McWilliams 2021-11-30 00:43:43 -05:00
parent fb3c35e7d1
commit 84228c8559
3 changed files with 22 additions and 8 deletions

1
.shellcheckrc Normal file
View File

@ -0,0 +1 @@
external-sources=true

4
opt.sh
View File

@ -1,4 +1,6 @@
source ./common.sh #!/bin/bash
source "./common.sh"
if [[ "${1}" == "" ]]; then if [[ "${1}" == "" ]]; then
echo "Please provide a directory as the first argument" echo "Please provide a directory as the first argument"

View File

@ -16,6 +16,7 @@ fi
INPUT=`realpath "${1}"` INPUT=`realpath "${1}"`
OUTPUT=`realpath "${2}"` OUTPUT=`realpath "${2}"`
INVERT="${3}" INVERT="${3}"
SINGLE="${4}"
if [ ! -d "${INPUT}" ]; then if [ ! -d "${INPUT}" ]; then
echo "Directory ${1} doesn't exist" echo "Directory ${1} doesn't exist"
@ -41,19 +42,16 @@ fi
IMAGES="" IMAGES=""
#files in dir stipple () {
for png in "${INPUT}/"*.png ; do png="${1}"
filename=`basename "${png}"` filename=`basename "${png}"`
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)}'`
tmp=`mktemp`.png tmp=`mktemp`.png
bash white.sh "${png}" "${tmp}" bash white.sh "${png}" "${tmp}"
cd ~/src/stipple_gen/ cd ~/src/stipple_gen/
if [ "${IMAGES}" == "" ]; then
part=`echo "${name}" | awk -F'_0' '{print $1}'`
IMAGES="${OUTPUT}/${part}_%06d_rendered.png"
VIDEO="${OUTPUT}/${part}.mov"
fi
bash stipple_gen.sh \ bash stipple_gen.sh \
--display "false" \ --display "false" \
--inputImage "${tmp}" \ --inputImage "${tmp}" \
@ -84,8 +82,21 @@ for png in "${INPUT}/"*.png ; do
svgsort "${OUTPUT}/${name}.svg" "${opt}" svgsort "${OUTPUT}/${name}.svg" "${opt}"
mv "${opt}" "${OUTPUT}/${name}.svg" mv "${opt}" "${OUTPUT}/${name}.svg"
fi fi
}
i=0;
#files in dir
for png in "${INPUT}/"*.png ; do
stipple "${png}"
i=$((i+1))
done done
if [[ "${IMAGES}" == "" ]]; then
part=`echo "${name}" | awk -F'_0' '{print $1}'`
IMAGES="${OUTPUT}/${part}_%06d_rendered.png"
VIDEO="${OUTPUT}/${part}.mov"
fi
ffmpeg -y -r ${FRAMERATE} -f image2 -i "${IMAGES}" \ ffmpeg -y -r ${FRAMERATE} -f image2 -i "${IMAGES}" \
-c:v prores_ks -profile:v 3 \ -c:v prores_ks -profile:v 3 \
"${VIDEO}" "${VIDEO}"