Degrade gracefully on overlay/audio failure; notify on upload success

Sunrise:
- Overlay failure no longer exits 1; the speed-only video is renamed to the
  expected final path so OnSuccess still fires and the upload still happens
- sunrise2mm.py now notifies on every upload outcome (success, post failure,
  file-not-found) via notify.sh so the user always knows whether the video
  reached Mattermost

Montage:
- Music+overlay failure no longer exits 1; the sped video is promoted to the
  *-Montage.mp4 path so year-end-join can still include this movement (as a
  silent, no-overlay clip) and the user is notified of the degraded output
- Year-end join trigger is now outside the success/failure branch so it fires
  in both cases

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-19 18:42:46 +00:00
parent 9c929f28d8
commit b911b228bb
3 changed files with 53 additions and 26 deletions
+13 -12
View File
@@ -140,22 +140,23 @@ DT="${DT}:x=w-tw-18:y=(h-th)/2"
DT="${DT}:shadowcolor=black@0.55:shadowx=1:shadowy=1"
# ── Step 3: Overlay — sunrise time burned in ──────────────────────────────────
# If this fails, $sped_video survives at its permanent path for manual recovery.
# If overlay fails, the sped video is promoted to the upload target so
# OnSuccess still fires and the upload happens (without timestamp overlay).
final_video="$output_dir/$current_date-daily-sunrise.mp4"
echo "Step 3/3: overlay → $final_video"
if ! ffmpeg -loglevel warning \
if ffmpeg -loglevel warning \
-i "$sped_video" \
-vf "${DT}" \
-c:v libx264 -pix_fmt yuv420p -crf "$CRF_SUNRISE" -an \
-y "$final_video"; then
"$SCRIPT_DIR/notify.sh" "FAILED: sunrise overlay $current_date" \
"Overlay failed — speed-only video saved: $(basename "$sped_video")" || true
exit 1
actual_dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$final_video")
echo "Done: $final_video (${actual_dur}s, sunrise at ${SR_TIME})"
rm -f "$sped_video"
"$SCRIPT_DIR/notify.sh" "Sunrise ready: $current_date" \
"$(basename "$final_video")${actual_dur}s, sunrise at ${SR_TIME}" || true
else
mv "$sped_video" "$final_video"
echo "Overlay failed — promoting speed-only video as upload target"
"$SCRIPT_DIR/notify.sh" "WARNING: sunrise overlay failed $current_date" \
"Overlay step failed — uploading speed-only video (no timestamp)" || true
fi
actual_dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$final_video")
echo "Done: $final_video (${actual_dur}s, sunrise at ${SR_TIME})"
rm -f "$sped_video"
"$SCRIPT_DIR/notify.sh" "Sunrise ready: $current_date" \
"$(basename "$final_video")${actual_dur}s, sunrise at ${SR_TIME}" || true