#!/bin/bash
#
# Uses uvccapture
# The ultimate destination for the shot.
destination=/home/fathead/Downloads/beans-tl
last_file=$(ls -tr | tail -1 | cut -c 1-5)
str_last_file="$(echo $last_file | sed 's/0*//')"
new_file=`printf "%05d" $(($str_last_file+1))`
filename=${new_file}.jpg
jpg_qual=100
delay_minutes=5
delay=$(($delay_minutes*60))
#delay=($delay_minutes)
#delay=15
width=$((1920))
height=$((1080))
while true ; do
uvccapture -x"$width" -y"$height" -q"$jpg_qual" -o"$filename"
# Image stamp it if `convert` is installed.
# if [ -e /usr/bin/convert ]; then
# convert -font helvetica -fill black -draw "text 10, 280 '`date`'" "$tempfile" "$tempfile"
# fi
# Move it into position.
# /bin/mv "$tempfile" "$destination"
# Pause
sleep $(($delay));
last_file=$(ls -tr | tail -1 | cut -c 1-5)
str_last_file="$(echo $last_file | sed 's/0*//')"
new_file=`printf "%05d" $(($str_last_file+1))`
filename=${new_file}.jpg
done
comment