summaryrefslogtreecommitdiff
path: root/scripts/webcamscript
blob: 2e56b6f588ead01f87eb48dca396ce1b7697c9ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

. settings

TODAY=`date`
TIME=`date +"%H"`

wget "${URL}" -O ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg &> /dev/null || exit 1

cp ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg ${WEBPATH}/public/img/buffer.thumb.${NAME}.webcam.jpg
mogrify -resize 200x150 ${WEBPATH}/public/img/buffer.thumb.${NAME}.webcam.jpg
if [ x"${TIMESTAMP}" == x"yes" ]; then
	if [ $TIME -lt 6 ] || [ $TIME -ge 18 ]; then
		mogrify -contrast-stretch 0 -fill white -gravity SouthEast -draw "text 10,10 '${TODAY}'" ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg
	else
		mogrify -contrast-stretch 0 -fill black -gravity SouthEast -draw "text 10,10 '${TODAY}'" ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg
	fi
fi

mv -f ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg ${WEBPATH}/public/img/${NAME}.webcam.jpg &> /dev/null
mv -f ${WEBPATH}/public/img/buffer.thumb.${NAME}.webcam.jpg ${WEBPATH}/public/img/thumb.${NAME}.webcam.jpg &> /dev/null
exit 0