sky-cam.conf (new) - Single file replaces mattermost_config.txt reference, notify_config.txt, and the hardcoded BASE_DIR/MUSIC_DIR/TIMEZONE scattered across scripts - Bash-sourceable and Python key=value readable (same format) All .sh scripts - source sky-cam.conf at startup; BASE_DIR / MUSIC_DIR from config sunrise2mm.py - Reads sky-cam.conf relative to script location; no hardcoded path notify.sh - Sources sky-cam.conf; Mattermost credentials come from there directly, no separate mattermost_config.txt lookup needed systemd/sky-cam-notify-failure@.service (new) - Template unit called by OnFailure= in each service - Sends notification via notify.sh when any sky-cam job fails - All three .service units now have OnFailure=sky-cam-notify-failure@%n.service Removed: notify_config.txt, sky-cam.crontab (superseded) https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
79 lines
2.9 KiB
Bash
Executable File
79 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# year-end-join.sh — concatenate all 12 movement montages for one astronomical
|
|
# year into a single "Four Seasons" video.
|
|
#
|
|
# Called automatically by montage-mvt.sh after the last Autumn movement finishes.
|
|
# Can also be run manually: ./year-end-join.sh 2025
|
|
#
|
|
# The 12 individual movement videos already carry their own attribution overlay
|
|
# (first 6 seconds of each), so no extra card is appended here.
|
|
#
|
|
# Output: $base_dir/movies/$script_name/$ASTRO_YEAR/$script_name-$ASTRO_YEAR.mp4
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
source "$SCRIPT_DIR/sky-cam.conf"
|
|
|
|
ASTRO_YEAR="${1:-}"
|
|
if [ -z "$ASTRO_YEAR" ]; then
|
|
echo "Usage: $0 <ASTRO_YEAR> (e.g. $0 2025)"
|
|
exit 1
|
|
fi
|
|
|
|
base_dir="$BASE_DIR"
|
|
script_name=$(basename "$SCRIPT_DIR" | cut -d'-' -f1)
|
|
year_dir="$base_dir/movies/$script_name/$ASTRO_YEAR"
|
|
|
|
echo "Assembling Four Seasons $ASTRO_YEAR from $year_dir ..."
|
|
|
|
# ── Collect the 12 montage files in season/movement order ────────────────────
|
|
concat_list=$(mktemp --suffix=.txt)
|
|
trap 'rm -f "$concat_list"' EXIT
|
|
|
|
missing=0
|
|
for season in Winter Spring Summer Autumn; do
|
|
for mvt in 1 2 3; do
|
|
mvt_dir="$year_dir/$season/Mvt$mvt/montage"
|
|
# Pick the newest (or only) montage file for this movement
|
|
f=$(find "$mvt_dir" -maxdepth 1 -name "*-Montage.mp4" 2>/dev/null | sort | tail -1)
|
|
if [ -z "$f" ]; then
|
|
echo "WARNING: missing montage for $season Mvt$mvt ($mvt_dir)"
|
|
missing=$((missing + 1))
|
|
else
|
|
echo " $season Mvt$mvt → $(basename "$f")"
|
|
printf "file '%s'\n" "$f" >> "$concat_list"
|
|
fi
|
|
done
|
|
done
|
|
|
|
found=$(wc -l < "$concat_list")
|
|
echo "$found of 12 movements found ($missing missing)"
|
|
|
|
if [ "$found" -eq 0 ]; then
|
|
echo "ERROR: no montage files found — aborting."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$missing" -gt 0 ]; then
|
|
echo "WARNING: joining with $missing movement(s) absent."
|
|
fi
|
|
|
|
# ── Join ──────────────────────────────────────────────────────────────────────
|
|
output_file="$year_dir/${script_name}-${ASTRO_YEAR}.mp4"
|
|
echo "Output: $output_file"
|
|
|
|
ffmpeg -loglevel warning \
|
|
-f concat -safe 0 -i "$concat_list" \
|
|
-c copy -y "$output_file"
|
|
|
|
total_dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$output_file")
|
|
total_min=$(echo "scale=1; $total_dur / 60" | bc)
|
|
echo "Done: $output_file (${total_min} min)"
|
|
|
|
# ── Notify ────────────────────────────────────────────────────────────────────
|
|
"$SCRIPT_DIR/notify.sh" \
|
|
"Four Seasons $ASTRO_YEAR complete" \
|
|
"${script_name}-${ASTRO_YEAR}.mp4 — ${total_min} minutes ($found movements)" \
|
|
|| true
|