all working i think

This commit is contained in:
2025-07-28 06:21:45 -07:00
parent b740ba9991
commit 211930cde3
30 changed files with 900 additions and 117 deletions

View File

@ -1,8 +1,8 @@
[Unit]
Description=Chrome
After=lldp_api.service
After=sddm.service
[Service]
Restart=always
RestartSec=3s
@ -13,8 +13,12 @@ ExecStart=/usr/bin/google-chrome \
--no-first-run \
--ignore-ssl-errors \
--disable-usb-keyboard-detect \
--window-size={{ chrome_resolution }}'
--app="{{ chrome_website }}"
--window-size="{{ item.chrome_resolution }}" \
--app="{{ item.chrome_website }}" \
{{ item.extra_chrome_configs}}
{{ item.extra_service_configs }}
[Install]
WantedBy=graphical-session.target
WantedBy=graphical-session.target

View File

@ -1,10 +1,9 @@
#!/bin/bash
# end the loop
rm $WORKING_DIR/run
sleep 5
rm $RUN_FILE
rm $WORKING_DIR/*temp*.jpg
# create timelapse
/bin/ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" \
-vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4
/bin/ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" -vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4 &

View File

@ -1,11 +0,0 @@
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,12 +1,12 @@
services:
photo_refresh:
container_name: photo_refresh
{{ container_name }}:
container_name: {{ container_name }}
image: php:8.0-apache
ports:
- 8080:80
- {{ container_http_port }}:80
volumes:
- ./html:/var/www/html/
- {{ working_folder }}/small_thumbs:/var/www/html/capture
{{ extra_volumes }}
network_mode: bridge
restart: always

View File

@ -1,63 +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/$FILENAME.jpg
# 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 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
# 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
NOW=$(date +%Y%m%d%H%M%S)
convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop 1920x830+0+260 +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg
fi
sleep 1
((i++))
done

View File

@ -0,0 +1,15 @@
[Unit]
Description=Timelapse Service Control API
After=network.target
[Service]
User=root
Group=root
WorkingDirectory={{ service_control_folder }}
ExecStartPre=/bin/sleep 5
ExecStart={{ service_control_folder }}/venv/bin/python {{ service_control_folder }}/app.py
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -1,5 +1,5 @@
#!/bin/bash
trap "source {{ working_folder }}/create_timelapse.sh &" SIGINT SIGTERM
trap "source {{ working_folder }}/create_timelapse.sh" SIGINT SIGTERM
# initialize all the variables
# basic things
@ -12,6 +12,7 @@ CITY=$(echo $WHERES_GALI | jq .city)
STATE=$(echo $WHERES_GALI | jq .state)
ZIPCODE=$(echo $WHERES_GALI | jq .postcode)
DISPLAY_NAME=$(echo $WHERES_GALI | jq .display_name)
RUN_FILE={{ working_folder }}/run
# Generate Status Report
mkdir -p $WORKING_DIR
@ -28,8 +29,9 @@ echo "/bin/ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" \\" >> {{ wo
echo "-vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4" >> {{ working_folder }}/generate_timelapses.sh
# capture time
touch $RUN_FILE
i=1
while [ $i ]
while [ -e $RUN_FILE ]
do
FILENAME=$(printf "img-%05d" "$i")
# old API based latlon