cron/webcam*: added systemd-files & made script more readable

This commit is contained in:
Felix Buehler 2017-04-17 14:50:26 +02:00
parent e3363f1f4c
commit 71298adbeb
4 changed files with 25 additions and 7 deletions

View file

@ -1,15 +1,14 @@
#!/bin/bash
## 0 * * * * cd ~/.dotfiles/cron/ && bash webcam.sh
## 0 * * * * ~/.dotfiles/cron/webcam.sh
now=$(date +"%Y_%m_%d_%H_%M_%S")
path="$HOME/Pictures/hour-pics/"
path="$HOME/Pictures/hour-pics"
size="1280x720"
basename=$(dirname $(readlink -f $0))
mkdir -p $path
streamer -q -f jpeg -s $size -o $path$now.jpeg -r 1
grey="$(python3 $(dirname $(readlink -f $0))/blackcheck.py -i $path$now.jpeg -d 10)"
# echo $grey
streamer -q -f jpeg -s $size -o $path/$now.jpeg -r 1
grey="$(python3 $basename/blackcheck.py -i $path/$now.jpeg -d 10)"
if [ "$grey" = "True" ] ; then
# echo "Has to move"
mv $path$now.jpeg ${path}black/$now.jpeg
mv $path/$now.jpeg $path/black/$now.jpeg
fi
exit 0