From 70304540753e42118e0b4f2c53247884dc106ade Mon Sep 17 00:00:00 2001 From: The_miro Date: Fri, 3 Jul 2026 10:24:35 +0200 Subject: [PATCH] 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). --- exec-cycle.sh | 23 ++++++++++++++++------- txt2printr.sh | 1 + webcam2ascii.sh | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100755 txt2printr.sh diff --git a/exec-cycle.sh b/exec-cycle.sh index a71fccd..94b68b5 100755 --- a/exec-cycle.sh +++ b/exec-cycle.sh @@ -1,14 +1,23 @@ #/bin/bash +trap 'stty sane; clear; exit 0' SIGINT SIGTERM + while true; do clear - echo "Press any key to capture image" - guvcview &> /dev/null & - read -n 1 - killall guvcview - ./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 - diff --git a/txt2printr.sh b/txt2printr.sh new file mode 100755 index 0000000..d16956c --- /dev/null +++ b/txt2printr.sh @@ -0,0 +1 @@ +#/bin/bash diff --git a/webcam2ascii.sh b/webcam2ascii.sh index f8e6581..9d11300 100755 --- a/webcam2ascii.sh +++ b/webcam2ascii.sh @@ -1,5 +1,5 @@ #/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