switched exec-cycle to a live >=2fps ascii preview loop and added txt2printr stub

replaced the guvcview+keypress capture flow with a continuous
capture/convert/display loop so the terminal shows a live ascii
preview; pressing c saves the frame and triggers the new
txt2printr.sh hook (currently a blank template).
master
Amir Alexander Abdelbaki 2026-07-03 10:24:35 +02:00
parent 494fa5dc64
commit 7030454075
3 changed files with 18 additions and 8 deletions

View File

@ -1,14 +1,23 @@
#/bin/bash #/bin/bash
trap 'stty sane; clear; exit 0' SIGINT SIGTERM
while true; do while true; do
clear clear
echo "Press any key to capture image"
guvcview &> /dev/null &
read -n 1
killall guvcview
./webcam2ascii.sh ./webcam2ascii.sh
read -n 1 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 done

1
txt2printr.sh Executable file
View File

@ -0,0 +1 @@
#/bin/bash

View File

@ -1,5 +1,5 @@
#/bin/bash #/bin/bash
fswebcam -r 640x480 --jpeg 85 -D 1 web-cam-shot.jpg &> /dev/null fswebcam -q --no-banner -r 640x480 --jpeg 85 web-cam-shot.jpg &> /dev/null
ascii-image-converter web-cam-shot.jpg | tee ascii-img.txt ascii-image-converter web-cam-shot.jpg | tee ascii-img.txt