-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·47 lines (40 loc) · 1.45 KB
/
start.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh
echo " ______ _____ _ __ "
echo " / ____/___ _____ ___ ___ _________ _ / ___/____ (_) /_____ "
echo ' / / / __ `/ __ `__ \/ _ \/ ___/ __ `/ \__ \/ __ \/ / //_/ _ \'
echo "/ /___/ /_/ / / / / / / __/ / / /_/ / ___/ / /_/ / / ,< / __/"
echo "\____/\__,_/_/ /_/ /_/\___/_/ \__,_/ /____/ .___/_/_/|_|\___/ "
echo " /_/ "
echo ""
echo ""
# Load .env
echo "> Loading .env"
if [ -f .env ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
export CAMERA_TIMEOUT="${CAMERA_TIMEOUT:-10}"
export MEDIA_PATH="${MEDIA_PATH:-$(pwd)/images}"
export IMAGE_HEIGHT="${IMAGE_HEIGHT:-500}"
export IMAGE_WIDTH="${IMAGE_WIDTH:-500}"
export ROTATION="${ROTATION:-0}"
echo " ├── CAMERA_TIMEOUT=$CAMERA_TIMEOUT (seconds)"
echo " ├── IMAGE_HEIGHT=$IMAGE_HEIGHT"
echo " ├── IMAGE_WIDTH=$IMAGE_WIDTH"
echo " └── MEDIA_PATH=$MEDIA_PATH"
echo " └── ROTATION=$ROTATION"
echo ""
# Start Web UI and Tor
echo "> Starting Web Server"
docker-compose up -d
echo ""
# Main loop that captures images
echo "> Capturing Frames"
while :
do
mkdir -p $MEDIA_PATH/$(date +"%Y/%m/%d")
export IMAGE_PATH=$MEDIA_PATH/$(date +"%Y/%m/%d")/frame-$(date +"%H-%M-%S")--$(date +"%s").jpg
raspistill -n -t 1 -o $IMAGE_PATH --width $IMAGE_WIDTH --height $IMAGE_HEIGHT --rotation $ROTATION
echo $IMAGE_PATH
sleep $CAMERA_TIMEOUT
done