3 # Get screenshots from bow, discard them if they dont change much.
5 source /usr
/local
/lib
/bash-bear
6 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
15 f
=/run
/user
/1000/ziva-tmp.jpg
21 if (( ${#jpgs[@]} >= 1 )); then
22 # shellcheck disable=SC2048 # intentional
23 lastf
=$
(ls -1 20*jpg |
tail -n1)
26 ssh bow DISPLAY
=:0 scrot
-z $f 2>/dev
/null ||
exit 0
27 rsync
--inplace bow
:$f $dest_dir 2>/dev
/null ||
exit 0
32 # returns 2 on error, but maybe in that case we want to ignore, file the image away
33 # and then it can go away in a subsequent comparison. going with that for now.
34 diff=$
(compare
-metric MSE
$lastf ziva-tmp.jpg
/dev
/null |
& sed 's/[^0-9].*//') ||
:
35 if printf "%s\n" "$diff" |
grep -E '^[0-9]+$' &>/dev
/null
&& (( diff < 200 )); then
43 mv ziva-tmp.jpg
"$(date +%F.%R)".jpg