initial commit, carputer ansible role
This commit is contained in:
15
templates/chrome-app.service.j2
Executable file
15
templates/chrome-app.service.j2
Executable file
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Chrome
|
||||
After=lldp_api.service
|
||||
After=sddm.service
|
||||
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=3s
|
||||
#ExecStartPre=/bin/sleep 5
|
||||
ExecStart=/usr/bin/google-chrome \
|
||||
--app="{{ chrome_website }}"
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
33
templates/record_snapshots.sh
Normal file
33
templates/record_snapshots.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
3
templates/sddm.conf.j2
Normal file
3
templates/sddm.conf.j2
Normal file
@ -0,0 +1,3 @@
|
||||
[Autologin]
|
||||
User=cosmos
|
||||
Session=plasma.desktop
|
||||
30
templates/timelapse_service.sh.j2
Normal file
30
templates/timelapse_service.sh.j2
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# initialize all the variables
|
||||
# basic things
|
||||
BEGIN=$(date +%Y%m%d-%H%M%S)
|
||||
WORKING_DIR="/opt/carputer/timelapse/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
|
||||
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)
|
||||
|
||||
# Generate Status Report
|
||||
mkdir -p $WORKING_DIR
|
||||
echo Timelapse Initiated at $BEGIN >> $WORKING_DIR/info.txt
|
||||
echo Shuttlecraft Galileo located at $CITY, $STATE $ZIPCODE >> $WORKING_DIR/info.txt
|
||||
echo $DISPLAY_NAME >> $WORKING_DIR/info.txt
|
||||
|
||||
# Set the run file and fork the loop
|
||||
touch $WORKING_DIR/run
|
||||
source ./record_snapshots.sh &
|
||||
|
||||
# set the trap and wait
|
||||
trap "source ./record_timelapse" SIGINT SIGTERM
|
||||
while true; do
|
||||
echo "Running..."
|
||||
sleep 1
|
||||
done
|
||||
14
templates/ustreamer.service.j2
Normal file
14
templates/ustreamer.service.j2
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=uStreamer - Lightweight HTTP Live Streaming server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/ustreamer --format=jpeg --resolution={{ resolution }} \
|
||||
--port={{ ustreamer_port}} --host=0.0.0.0 --device={{ video_device }}
|
||||
|
||||
Restart=always
|
||||
User=ustreamer
|
||||
Group=ustreamer
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user