Add Demoio directory for test videos with 8-day retention; capture gap warning
daily_sunrise_video.sh:
- Test output now saves to DEMO_DIR/<cam>/ (default: MOVIES_DIR/demoio/<cam>/)
instead of the production sunrise-only directory
- After each test run, deletes test files older than DEMO_RETENTION_DAYS (8)
- Production mode: warns if the last selected frame is >3 intervals before
the window end, which indicates the capture service had a gap near sunrise:
WARNING: last frame is 20min 0s before window end — capture gap near sunrise
Check: systemctl --user status sky-cam-capture-east.service
sky-cam.conf: add DEMO_DIR and DEMO_RETENTION_DAYS settings
https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
+23
-2
@@ -114,6 +114,15 @@ first_t=$(basename "${images[0]}" .jpg | tr '-' ':')
|
||||
last_t=$(basename "${images[-1]}" .jpg | tr '-' ':')
|
||||
echo "Images: ${#images[@]} (${first_t} → ${last_t} overlay: ${SR_TIME})"
|
||||
|
||||
if ! $TEST_MODE; then
|
||||
last_sec=$(time_to_seconds "$(basename "${images[-1]}" .jpg)")
|
||||
gap=$(( end_sec - last_sec ))
|
||||
if [ "$gap" -gt $(( ${CAPTURE_INTERVAL:-10} * 3 )) ]; then
|
||||
echo "WARNING: last frame is $(( gap / 60 ))min ${gap}s before window end — capture gap near sunrise"
|
||||
echo " Check: systemctl --user status sky-cam-capture-${CAM_NAME}.service"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Concat list with explicit frame duration so each frame represents real elapsed
|
||||
# time. Without this, all frames collapse to timestamp 0 → one-frame video.
|
||||
# The final entry needs a duplicate without duration (ffmpeg concat requirement).
|
||||
@@ -261,7 +270,9 @@ fi
|
||||
# audio ✗ overlay ✓ → final has overlay, no audio
|
||||
# audio ✗ overlay ✗ → sped video promoted (no audio, no overlay)
|
||||
if $TEST_MODE; then
|
||||
final_video="$output_dir/$current_date-daily-sunrise-test.mp4"
|
||||
demo_dir="${DEMO_DIR:-$MOVIES_DIR/demoio}/$CAM_NAME"
|
||||
mkdir -p "$demo_dir"
|
||||
final_video="$demo_dir/$current_date-daily-sunrise-test.mp4"
|
||||
else
|
||||
final_video="$output_dir/$current_date-daily-sunrise.mp4"
|
||||
fi
|
||||
@@ -334,7 +345,17 @@ if $step3b_ok; then
|
||||
echo "Done: $final_video (${actual_dur}s, time: ${SR_TIME})"
|
||||
rm -f "$sped_video" "$temp_audio" 2>/dev/null || true; temp_audio=""
|
||||
|
||||
if ! $TEST_MODE; then
|
||||
if $TEST_MODE; then
|
||||
# ── Demo retention ────────────────────────────────────────────────────
|
||||
demo_retain="${DEMO_RETENTION_DAYS:-8}"
|
||||
if [ "$demo_retain" -gt 0 ]; then
|
||||
deleted_demo=$(find "${DEMO_DIR:-$MOVIES_DIR/demoio}" \
|
||||
-name "*-daily-sunrise-test.mp4" \
|
||||
-mtime +"$demo_retain" -print -delete 2>/dev/null | wc -l)
|
||||
[ "$deleted_demo" -gt 0 ] && \
|
||||
echo "Demo retention: deleted $deleted_demo test file(s) older than ${demo_retain} days"
|
||||
fi
|
||||
else
|
||||
[ -f "${cam_audio:-}" ] && rm -f "${cam_audio:-}"
|
||||
"$SCRIPT_DIR/notify.sh" "Sunrise ready: $current_date" \
|
||||
"$(basename "$final_video") — ${actual_dur}s, sunrise at ${SR_TIME} | $final_video" || true
|
||||
|
||||
@@ -228,6 +228,10 @@ SUNRISE_RETENTION_DAYS=10
|
||||
# Delete unpinned sunrise posts from Mattermost older than this many days.
|
||||
# Pinned posts are always kept regardless. Set 0 to disable Mattermost cleanup.
|
||||
MM_SUNRISE_RETENTION_DAYS=8
|
||||
# Output directory for --test runs. Kept separate from production sunrise videos.
|
||||
# Test files older than DEMO_RETENTION_DAYS are deleted automatically.
|
||||
DEMO_DIR="${DEMO_DIR:-$MOVIES_DIR/demoio}"
|
||||
DEMO_RETENTION_DAYS=8
|
||||
|
||||
# ── Video encoding quality ────────────────────────────────────────────────────
|
||||
# FFmpeg CRF: lower = higher quality / larger files. Typical range 18–30.
|
||||
|
||||
Reference in New Issue
Block a user