All paths into sky-cam.conf; install.sh generates systemd units
sky-cam.conf - Add SCRIPT_DIR (install location) and CAM_NAME (camera/folder name) - These are the only values that change when deploying to a new machine install.sh (new) - Sources sky-cam.conf, generates all systemd .service and .timer units with correct ExecStart paths, then enables and starts the timers - Run once after editing sky-cam.conf; run again if paths change - Supports --system flag for system-wide install All .sh scripts + sunrise2mm.py - No hardcoded paths remain - script_name=$(basename ...) derivation replaced by $CAM_NAME from conf - sunrise_video.10s.sh now sources sky-cam.conf for BASE_DIR, CAM_NAME, and SCRIPT_DIR (replaces all /home/motion/... references) - sunrise2mm.py builds video path from BASE_DIR + CAM_NAME in conf systemd/ template files kept as reference but no longer need editing https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
+9
-11
@@ -1,25 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||
source "$SCRIPT_DIR/sky-cam.conf"
|
||||
|
||||
# Get today's date in the format YYYY-MM-DD
|
||||
current_date=$(date +%Y-%m-%d)
|
||||
output_date=$(date +%Y-%m)
|
||||
|
||||
# Extract the base directory and the first word of the script's folder name
|
||||
base_dir="/home/motion/drives/local-2tb"
|
||||
script_dir=$(dirname "$(realpath "$0")") # Get the directory where the script is located
|
||||
first_word_of_script_folder=$(basename "$script_dir" | cut -d'-' -f1)
|
||||
|
||||
# Define the directory where images are stored (using today's date)
|
||||
image_dir="$base_dir/$first_word_of_script_folder/$current_date"
|
||||
image_dir="$BASE_DIR/$CAM_NAME/$current_date"
|
||||
|
||||
# Set output directory (new structure with 'sunrise-only' subfolder)
|
||||
output_dir="/home/motion/drives/local-2tb/movies/sunrise/$output_date/sunrise-only"
|
||||
# Set output directory
|
||||
output_dir="$BASE_DIR/movies/$CAM_NAME/$output_date/sunrise-only"
|
||||
|
||||
# Make sure the output directory exists
|
||||
mkdir -p "$output_dir"
|
||||
|
||||
# Get the sunrise time for today using the sunrise.py script
|
||||
sunrise_time=$(python3 /home/motion/drives/local-2tb/sunrise-scripts/sunrise.py)
|
||||
sunrise_time=$(python3 "$SCRIPT_DIR/sunrise.py")
|
||||
|
||||
# Check if the sunrise time was fetched successfully
|
||||
if [[ -z "$sunrise_time" ]]; then
|
||||
@@ -143,10 +141,10 @@ echo "Video created at $final_video"
|
||||
rm "$temp_file"
|
||||
|
||||
# Run the sunrise_overlay.py script to add the sunrise overlay
|
||||
python3 /home/motion/drives/local-2tb/sunrise-scripts/sunrise_overlay.py "$final_video"
|
||||
python3 "$SCRIPT_DIR/sunrise_overlay.py" "$final_video"
|
||||
|
||||
# Run the sunrise2mm.py script to upload the video
|
||||
python3 /home/motion/drives/local-2tb/sunrise-scripts/sunrise2mm.py
|
||||
python3 "$SCRIPT_DIR/sunrise2mm.py"
|
||||
|
||||
# Check if the Python script was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user