ascii-photobooth/exec-cycle.sh

24 lines
661 B
Bash
Executable File

#/bin/bash
trap 'stty sane; clear; exit 0' SIGINT SIGTERM
while true; do
clear
./webcam2ascii.sh
echo
echo "[c] capture [Ctrl+C] quit"
if read -n 1 -t 0.05 -s key && [[ "$key" == "c" || "$key" == "C" ]]; then
timestamp=$(date +%Y%m%d-%H%M%S)
cp web-cam-shot.jpg "photo-$timestamp.jpg"
cp ascii-img.txt "ascii-img-$timestamp.txt"
clear
cat "ascii-img-$timestamp.txt"
echo
echo "Saved photo-$timestamp.jpg and ascii-img-$timestamp.txt"
./txt2printr.sh "ascii-img-$timestamp.txt"
read -n 1 -s -p "Press any key to resume live preview, Ctrl+C to quit..."
fi
done