4-seasons: exit cleanly when all frames fail validation
Accessing ${images[-1]} on an empty array under set -u causes a bash
error. Guard with an explicit check so a fully-corrupt image directory
exits with a clear message instead of a cryptic crash.
https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
@@ -123,6 +123,11 @@ done
|
|||||||
[ "$bad" -gt 0 ] && echo "WARNING: skipped $bad corrupt/empty frame(s) of ${#all_images[@]}"
|
[ "$bad" -gt 0 ] && echo "WARNING: skipped $bad corrupt/empty frame(s) of ${#all_images[@]}"
|
||||||
[ "$grey" -gt 0 ] && echo "INFO: skipped $grey grey/uniform frame(s) (SEASONS_GREY_STDDEV_MIN=${GREY_MIN})"
|
[ "$grey" -gt 0 ] && echo "INFO: skipped $grey grey/uniform frame(s) (SEASONS_GREY_STDDEV_MIN=${GREY_MIN})"
|
||||||
|
|
||||||
|
if [ "${#images[@]}" -eq 0 ]; then
|
||||||
|
echo "ERROR: no valid images remain after filtering — skipping $yesterday."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
for img in "${images[@]}"; do
|
for img in "${images[@]}"; do
|
||||||
printf "file '%s'\nduration %s\n" "$img" "$INTERVAL"
|
printf "file '%s'\nduration %s\n" "$img" "$INTERVAL"
|
||||||
done > "$temp_file"
|
done > "$temp_file"
|
||||||
|
|||||||
Reference in New Issue
Block a user