update readme

This commit is contained in:
2025-07-26 17:25:18 -07:00
parent b81872440f
commit a29ec39252
20 changed files with 335 additions and 95 deletions

View File

@ -3,12 +3,17 @@ Description=Chrome
After=lldp_api.service
After=sddm.service
[Service]
Restart=always
RestartSec=3s
#ExecStartPre=/bin/sleep 5
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/google-chrome \
--disable-pinch \
--disable-translate \
--no-first-run \
--ignore-ssl-errors \
--disable-usb-keyboard-detect \
--window-size={{ chrome_resolution }}'
--app="{{ chrome_website }}"
[Install]

View File

@ -0,0 +1,6 @@
#!/bin/bash
# create timelapse
ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" \
-vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4

View File

@ -0,0 +1,11 @@
services:
photo_refresh:
container_name: photo_refresh
image: photo_refresh
ports:
- 3000:3000
volumes:
- {{ working_folder }}/small_thumbs:/usr/src/app/public
network_mode: bridge
restart: always

View File

@ -1,33 +0,0 @@
#!/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

View File

@ -0,0 +1,57 @@
#!/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/$FILENAME.jpg
# This variable is for the timestamp
TIME=$(date +%c)
# 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
# This is for the tiny pic
# I'll make one every 5 seconds
# I have 1340x580. i think i will truncate the top
# Calculate the height to trim based on the aspect ratios of the input and output images
if (( $i % 5 == 0 )); then
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)
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
fi
sleep 1
((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

View File

@ -0,0 +1,12 @@
[Unit]
Description=Timelapse service
After=network.target
[Service]
ExecStart=/opt/carputer/timelapse/timelapse_service.sh
Restart=always
User=timelapse
Group=timelapse
[Install]
WantedBy=multi-user.target

View File

@ -3,7 +3,7 @@
# initialize all the variables
# basic things
BEGIN=$(date +%Y%m%d-%H%M%S)
WORKING_DIR="/opt/carputer/timelapse/storage/$BEGIN"
WORKING_DIR="{{ working_folder }}/storage/$BEGIN"
# be greedy about API calls
WHERES_GALI=$(curl -s http://10.18.1.1:8184/wheres_gali?api_key={{ tesla_api_key }})
# parse the one API call
@ -20,10 +20,10 @@ echo $DISPLAY_NAME >> $WORKING_DIR/info.txt
# Set the run file and fork the loop
touch $WORKING_DIR/run
source ./record_snapshots.sh &
source {{ working_folder }}/record_snapshots.sh &
# set the trap and wait
trap "source ./record_timelapse" SIGINT SIGTERM
trap "source {{ working_folder }}/create_timelapse.sh &" SIGINT SIGTERM
while true; do
echo "Running..."
sleep 1