From 8c752fc165a9e5e245565ec231d8f4c48e0a4ece Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 20 Apr 2026 16:28:15 +0000 Subject: [PATCH] Require camera name explicitly across all seasons scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No script defaults to SUNRISE_CAM (east) for the seasons pipeline. Every direction is treated equally — camera name is a required arg, not an optional override. - 4-seasons.sh: $1 required, exits with usage if missing - montage-mvt.sh: arg order changed to [date]; $1 required - year-end-join.sh: $2 (cam) required - verify-mvt.sh: $4 (cam) required - migrate-seasons.sh: example commands updated to new arg order - README.md: montage-mvt.sh examples updated https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- 4-seasons.sh | 11 ++++++++--- README.md | 4 ++-- migrate-seasons.sh | 16 ++++++++-------- montage-mvt.sh | 15 +++++++++++---- verify-mvt.sh | 12 ++++++------ year-end-join.sh | 7 +++++-- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/4-seasons.sh b/4-seasons.sh index ac07487..a162db6 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -13,8 +13,13 @@ SCRIPT_DIR="$(dirname "$(realpath "$0")")" source "$SCRIPT_DIR/sky-cam.conf" export TIMEZONE # make it visible to season_info.py subprocess -# Camera name: first argument overrides conf (systemd passes it via ExecStart). -CAM_NAME="${1:-$SUNRISE_CAM}" +# Camera name: required first argument (systemd passes it via ExecStart). +CAM_NAME="${1:-}" +if [ -z "$CAM_NAME" ]; then + echo "Usage: $0 " + echo " e.g. $0 east or $0 north" + exit 1 +fi # ── Configuration ────────────────────────────────────────────────────────────── base_dir="$BASE_DIR" @@ -125,5 +130,5 @@ if [ "$IS_LAST_DAY" = "true" ]; then echo "Last day of $SEASON Mvt $MVT_NUM — triggering montage compilation..." # Pass $yesterday so montage-mvt.sh looks up the correct movement # (running the next morning, "today" would already be the next movement). - "$SCRIPT_DIR/montage-mvt.sh" "$yesterday" "$CAM_NAME" + "$SCRIPT_DIR/montage-mvt.sh" "$CAM_NAME" "$yesterday" fi diff --git a/README.md b/README.md index 165397b..2ed5e63 100644 --- a/README.md +++ b/README.md @@ -227,8 +227,8 @@ Attribution data for every file is written to `sunrise-sounds/manifest.json`. **Rebuild a movement montage** (e.g. to retry audio after a failure): ```bash -./montage-mvt.sh # uses today's movement -./montage-mvt.sh 2025-06-15 east # specific date + camera +./montage-mvt.sh east # uses today's date +./montage-mvt.sh east 2025-06-15 # specific date ``` **Rebuild the year-end video**: diff --git a/migrate-seasons.sh b/migrate-seasons.sh index 9fef5b2..3161a03 100755 --- a/migrate-seasons.sh +++ b/migrate-seasons.sh @@ -17,10 +17,10 @@ # (default: ~/drives/local-2tb/movies/sunrise) # # After running, trigger montages for completed movements: -# ./montage-mvt.sh 2026-04-19 east # Spring Mvt1 (~30/31 days) -# ./montage-mvt.sh 2026-01-18 east # Winter Mvt1 (~18/29 days) -# ./montage-mvt.sh 2026-02-16 east # Winter Mvt2 (~24/29 days) -# ./montage-mvt.sh 2026-03-19 east # Winter Mvt3 (~20/31 days) +# ./montage-mvt.sh east 2026-04-19 # Spring Mvt1 +# ./montage-mvt.sh east 2026-01-18 # Winter Mvt1 +# ./montage-mvt.sh east 2026-02-16 # Winter Mvt2 +# ./montage-mvt.sh east 2026-03-19 # Winter Mvt3 set -euo pipefail @@ -122,10 +122,10 @@ $DRY_RUN && echo "Re-run without --dry-run to move the files." && echo "" echo "Next steps:" echo " 1. Build montages for completed movements:" -echo " ./montage-mvt.sh 2026-04-19 $CAM # Spring Mvt1 (today is last day)" -echo " ./montage-mvt.sh 2026-01-18 $CAM # Winter Mvt1" -echo " ./montage-mvt.sh 2026-02-16 $CAM # Winter Mvt2" -echo " ./montage-mvt.sh 2026-03-19 $CAM # Winter Mvt3" +echo " ./montage-mvt.sh $CAM 2026-04-19 # Spring Mvt1" +echo " ./montage-mvt.sh $CAM 2026-01-18 # Winter Mvt1" +echo " ./montage-mvt.sh $CAM 2026-02-16 # Winter Mvt2" +echo " ./montage-mvt.sh $CAM 2026-03-19 # Winter Mvt3" echo " 2. Confirm each montage plays correctly with music." echo " 3. Delete temp files from old archive:" echo " find \"$OLD_ROOT\" -name '*-temp.mp4' -delete" diff --git a/montage-mvt.sh b/montage-mvt.sh index 7601c91..d5bf98f 100755 --- a/montage-mvt.sh +++ b/montage-mvt.sh @@ -22,9 +22,17 @@ SCRIPT_DIR="$(dirname "$(realpath "$0")")" source "$SCRIPT_DIR/sky-cam.conf" export TIMEZONE # make it visible to season_info.py subprocess -# Args: [date] [camera-name] -# Camera name: second argument overrides conf (passed through from 4-seasons.sh). -CAM_NAME="${2:-$SUNRISE_CAM}" +# Args: [date] +# Camera name: required first argument. +# Date: optional second argument (defaults to today; pass yesterday's date when +# running the morning after the last day of a movement). +CAM_NAME="${1:-}" +DATE_ARG="${2:-}" +if [ -z "$CAM_NAME" ]; then + echo "Usage: $0 [YYYY-MM-DD]" + echo " e.g. $0 east 2026-04-19" + exit 1 +fi # ── Configuration ────────────────────────────────────────────────────────────── base_dir="$BASE_DIR" @@ -38,7 +46,6 @@ ATTR_DUR="$MONTAGE_ATTR_DUR" ATTR_FADE="$MONTAGE_ATTR_FADE" # ── Season / movement info ──────────────────────────────────────────────────── -DATE_ARG="${1:-}" _season_info="$(python3 "$SCRIPT_DIR/season_info.py" ${DATE_ARG:+"$DATE_ARG"})" || { echo "Error: season_info.py failed — check Python dependencies (suntime pytz)" exit 1 diff --git a/verify-mvt.sh b/verify-mvt.sh index da59351..eafbe7b 100755 --- a/verify-mvt.sh +++ b/verify-mvt.sh @@ -2,7 +2,7 @@ # verify-mvt.sh — review a completed movement montage and manage source JPEGs. # # Usage: -# ./verify-mvt.sh [CAM_NAME] +# ./verify-mvt.sh # # Shows technical checks on the montage, lets you play it, then: # (p) play — open in ffplay / mpv / vlc (whichever is available) @@ -21,10 +21,10 @@ export TIMEZONE ASTRO_YEAR="${1:-}" SEASON="${2:-}" MVT_NUM="${3:-}" -CAM_NAME="${4:-$SUNRISE_CAM}" +CAM_NAME="${4:-}" -if [ -z "$ASTRO_YEAR" ] || [ -z "$SEASON" ] || [ -z "$MVT_NUM" ]; then - echo "Usage: $0 [CAM_NAME]" +if [ -z "$ASTRO_YEAR" ] || [ -z "$SEASON" ] || [ -z "$MVT_NUM" ] || [ -z "$CAM_NAME" ]; then + echo "Usage: $0 " echo " e.g. $0 2025 Spring 1 east" exit 1 fi @@ -174,7 +174,7 @@ while true; do r) echo " Re-running music+overlay step..." - "$SCRIPT_DIR/montage-mvt.sh" "$mvt_start_date" "$CAM_NAME" + "$SCRIPT_DIR/montage-mvt.sh" "$CAM_NAME" "$mvt_start_date" break ;; @@ -183,7 +183,7 @@ while true; do # Remove sped file so montage-mvt.sh starts from scratch find "$MOVIES_DIR/$CAM_NAME/$ASTRO_YEAR/$SEASON/Mvt${MVT_NUM}" \ -maxdepth 1 -name "*-Sped.mp4" -delete 2>/dev/null || true - "$SCRIPT_DIR/montage-mvt.sh" "$mvt_start_date" "$CAM_NAME" + "$SCRIPT_DIR/montage-mvt.sh" "$CAM_NAME" "$mvt_start_date" break ;; diff --git a/year-end-join.sh b/year-end-join.sh index d8430f5..3ae21f8 100755 --- a/year-end-join.sh +++ b/year-end-join.sh @@ -20,8 +20,11 @@ if [ -z "$ASTRO_YEAR" ]; then echo "Usage: $0 [CAM_NAME] (e.g. $0 2025 north)" exit 1 fi -# Camera name: second argument overrides conf (passed through from montage-mvt.sh). -CAM_NAME="${2:-$SUNRISE_CAM}" +CAM_NAME="${2:-}" +if [ -z "$CAM_NAME" ]; then + echo "Usage: $0 (e.g. $0 2025 north)" + exit 1 +fi year_dir="$MOVIES_DIR/$CAM_NAME/$ASTRO_YEAR"