summaryrefslogtreecommitdiff
path: root/scripts/trollette.sh
blob: 3786fc12275c99e75093bfb63d840c34c8be9c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

WEBPATH="../"
NAME="klo"
TIMESTAMP="yes"
BILD=`python trollette.py`


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

cp $BILD ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg > /dev/null 2>&1 || exit 1

cp ${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg ${WEBPATH}/public/img/buffer.thumb.${NAME}.webcam.jpg

mogrify +noise Gaussian -attenuate 0.4 -adaptive-sharpen 3 -resize 208x117 ${WEBPATH}/public/img/buffer.thumb.${NAME}.webcam.jpg

if [ x"${TIMESTAMP}" = x"yes" ]; then
	if [ $TIME -lt 6 ] || [ $TIME -ge 18 ]; then
		mogrify +noise Gaussian -attenuate 0.4 -adaptive-sharpen 3 \
			-fill white -gravity SouthEast \
			-draw "text 10,10 '${TODAY}'" \
			${WEBPATH}/public/img/buffer.${NAME}.webcam.jpg
	else
		mogrify +noise Gaussian -attenuate 0.4 -adaptive-sharpen 3 \
			-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