#!/bin/bash # this saves a snapshot of the camera every second or so depending on how long all the other crap takes # let's hope the vars make it otherwise imma need to parse a bollocksing file i=1 while [ -f "$WORKING_DIR/run" ] do FILENAME=$(printf "img-%05d" "$i") LATLON=$(curl -s http://10.18.1.1:8184/where_is?api_key={{ tesla_api_key }} ) LON=$(echo $LATLON | jq .lon) LAT=$(echo $LATLON | jq .lat) COORDINATES="$LAT, $LON" curl http://127.0.0.1:7123/snapshot --output $WORKING_DIR/$BEGIN/$FILENAME.jpg # This variable is for the timestamp TIME=$(date +%Y%m%d-%H%M)xqa # This should add the current time to the image and save it convert $WORKING_DIR/$BEGIN/$FILENAME.jpg -gravity NorthWest -pointsize 22 \ -fill yellow -annotate +30+30 $TIME $WORKING_DIR/$BEGIN/$FILENAME-temp.jpg # Delete original rm $WORKING_DIR/$BEGIN/$FILENAME.jpg # This should add the current latlon to the image and save it convert $WORKING_DIR/$BEGIN/$FILENAME-temp.jpg -gravity NorthEast -pointsize 22 \ -fill yellow -annotate +30+30 $COORDINATES $WORKING_DIR/$BEGIN/$FILENAME.jpg # Delete temp rm $WORKING_DIR/$BEGIN/$FILENAME-temp.jpg sleep 1 ((i++)) done