Fix bugs found in post-refactor audit

- verify-mvt.sh: remove dead first _info= line (used MVT_START before
  defined); fix JPEG size loop to accumulate bytes correctly and display
  human-readable total; show size in delete confirmation
- montage-mvt.sh: grep -c uses || echo 0 instead of || true to be
  unambiguous about the no-match value under set -e
- capture.sh, capture-watchdog.sh: require camera name arg, remove
  silent SUNRISE_CAM fallback
- migrate-seasons.sh: require --cam arg, error if missing
- README.md, sky-cam.conf: remove stale fullday-video.sh references;
  README pipeline diagram updated to show verify-mvt.sh

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-20 16:34:05 +00:00
parent 8c752fc165
commit c4fb086f1d
7 changed files with 30 additions and 35 deletions
+8 -21
View File
@@ -40,13 +40,7 @@ if [ -z "$montage_file" ] || [ ! -f "$montage_file" ]; then
fi
# ── Get movement date range from season_info ──────────────────────────────────
_info="$(python3 "$SCRIPT_DIR/season_info.py" "$MVT_START" 2>/dev/null)" 2>/dev/null || true
# Use the sped file's date prefix to find a representative date in the movement
sped_file=$(find "$MOVIES_DIR/$CAM_NAME/$ASTRO_YEAR/$SEASON/Mvt${MVT_NUM}" \
-maxdepth 1 -name "*-Sped.mp4" 2>/dev/null | head -n 1 || true)
# Get MVT_START from the montage filename (format: YYYY-MM-DD_Season_MvtN-Montage.mp4)
# Extract date from montage filename (format: YYYY-MM-DD_Season_MvtN-Montage.mp4)
mvt_start_date=$(basename "$montage_file" | cut -d_ -f1)
_info="$(python3 "$SCRIPT_DIR/season_info.py" "$mvt_start_date")"
eval "$_info"
@@ -89,30 +83,23 @@ printf " File size : %s\n" "$file_size"
printf " Daily clips : %d / %d days\n" "$final_count" "$DAYS_IN_MVT"
printf " Music : %s\n" "$(basename "${music_file:-NOT FOUND}")"
# Count JPEG folders available for deletion
# Count JPEG folders and sum their sizes
jpeg_count=0
jpeg_size=0
jpeg_bytes=0
d="$MVT_START"
while [[ "$d" < "$MVT_END" || "$d" == "$MVT_END" ]]; do
dir="$BASE_DIR/$CAM_NAME/$d"
if [ -d "$dir" ]; then
jpeg_count=$(( jpeg_count + 1 ))
jpeg_bytes=$(( jpeg_bytes + $(du -sb "$dir" 2>/dev/null | cut -f1 || echo 0) ))
fi
d=$(date -d "$d + 1 day" +%Y-%m-%d)
done
if [ "$jpeg_count" -gt 0 ]; then
jpeg_size=$(du -sh "$BASE_DIR/$CAM_NAME" --exclude="*" 2>/dev/null || true)
# Sum only the movement date folders
total_jpeg_bytes=0
d="$MVT_START"
while [[ "$d" < "$MVT_END" || "$d" == "$MVT_END" ]]; do
dir="$BASE_DIR/$CAM_NAME/$d"
[ -d "$dir" ] && total_jpeg_bytes=$(du -sb "$dir" 2>/dev/null | cut -f1 || echo 0) || true
d=$(date -d "$d + 1 day" +%Y-%m-%d)
done
printf " JPEG folders : %d date folders (%s → %s)\n" \
"$jpeg_count" "$MVT_START" "$MVT_END"
jpeg_size=$(numfmt --to=iec-i --suffix=B "$jpeg_bytes" 2>/dev/null || echo "${jpeg_bytes}B")
printf " JPEG folders : %d date folders, %s (%s → %s)\n" \
"$jpeg_count" "$jpeg_size" "$MVT_START" "$MVT_END"
else
printf " JPEG folders : none found (already deleted)\n"
fi
@@ -148,7 +135,7 @@ while true; do
continue
fi
echo ""
echo " Will delete $jpeg_count JPEG date folders ($MVT_START$MVT_END) for camera [$CAM_NAME]."
echo " Will delete $jpeg_count JPEG date folders ($MVT_START$MVT_END) for camera [$CAM_NAME]${jpeg_size}."
echo " The montage video and daily clips are kept."
read -rp " Confirm? [yes/no]: " confirm
if [ "$confirm" = "yes" ]; then