back-end ustreamer, GPS, timelapse, and photo-refresh site working

This commit is contained in:
2025-07-27 15:10:11 -07:00
parent 7496df0174
commit b740ba9991
22 changed files with 443 additions and 99 deletions

View File

@ -1,12 +1,4 @@
#!/bin/bash
# no need to do this math forever
input_width=1920
input_height=1080
output_width=1340
output_height=580
# Calculate the ratio for trimming the top part
trim_ratio=$(echo "scale=4; $output_height / $output_width * $input_width" | bc)
# 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
@ -23,10 +15,37 @@ do
# This variable is for the timestamp
TIME=$(date +%c)
# Save the initial image in a temp file
convert $WORKING_DIR/$FILENAME.jpg -gravity SouthWest -pointsize 44 \
-fill yellow -annotate +30+30 "$TIME" $WORKING_DIR/$FILENAME-temp1.jpg
# Add the second annotation to the temp file
convert $WORKING_DIR/$FILENAME-temp1.jpg -gravity SouthEast -pointsize 44 \
-fill yellow -annotate +30+30 "$COORDINATES" $WORKING_DIR/$FILENAME-temp2.jpg
# Append the two images and save the final result
convert $WORKING_DIR/$FILENAME-temp2.jpg -append $WORKING_DIR/$FILENAME.jpg
# Optionally, remove intermediate files if you don't need them
rm $WORKING_DIR/$FILENAME-temp1.jpg $WORKING_DIR/$FILENAME-temp2.jpg
# this big boi should add both the timestamp and the coordinates
convert $WORKING_DIR/$FILENAME.jpg \( +clone -gravity NorthWest -pointsize 22 -fill yellow -annotate +30+30 "$TIME" \) \
\( +clone -gravity NorthEast -pointsize 22 -fill yellow -annotate +30+30 "$COORDINATES" \) \
-append $WORKING_DIR/$FILENAME.jpg
#convert $WORKING_DIR/$FILENAME.jpg \( +clone -gravity NorthWest -pointsize 44 -fill yellow -annotate +30+30 "$TIME" $WORKING_DIR/$FILENAME-time.jpg\) \
#\( +clone -gravity NorthEast -pointsize 44 -fill yellow -annotate +30+30 "$COORDINATES" $WORKING_DIR/$FILENAME-final.jpg\)
#-append $WORKING_DIR/$FILENAME.jpg
# This should add the current time to the image and save it
#convert $WORKING_DIR/$FILENAME.jpg -gravity SouthWest -pointsize 44 \
#-fill yellow -annotate +30+30 $TIME $WORKING_DIR/$FILENAME-temp.jpg
# Delete original
#rm $WORKING_DIR/$FILENAME.jpg
# This should add the current latlon to the image and save it
#convert $WORKING_DIR/$FILENAME-temp.jpg -gravity SouthEast -pointsize 44 \
#-fill yellow -annotate +30+30 $COORDINATES $WORKING_DIR/$FILENAME-final.jpg
# Delete temp
#rm $WORKING_DIR/$FILENAME-temp.jpg
# This is for the tiny pic
# I'll make one every 5 seconds
@ -34,7 +53,7 @@ do
# Calculate the height to trim based on the aspect ratios of the input and output images
if (( $i % 5 == 0 )); then
NOW=$(date +%Y%m%d%H%M%S)
convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop x$trim_ratio +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg
convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop 1920x830+0+260 +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg
fi
sleep 1
@ -42,17 +61,3 @@ do
((i++))
done
# old one-at-a-time rubbish
# # This should add the current time to the image and save it
# convert $WORKING_DIR/$FILENAME.jpg -gravity NorthWest -pointsize 22 \
# -fill yellow -annotate +30+30 $TIME $WORKING_DIR/$FILENAME-temp.jpg
# # Delete original
# rm $WORKING_DIR/$FILENAME.jpg
#
# # This should add the current latlon to the image and save it
# convert $WORKING_DIR/$FILENAME-temp.jpg -gravity NorthEast -pointsize 22 \
# -fill yellow -annotate +30+30 $COORDINATES $WORKING_DIR/$FILENAME.jpg
# # Delete temp
# rm $WORKING_DIR/$FILENAME-temp.jpg