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
+15 -14
View File
@@ -178,8 +178,9 @@ DT="${DT}:alpha='${ALPHA}':enable='${ENABLE}'"
output_file="$output_dir/${MVT_START}_${SEASON}_Mvt${MVT_NUM}-Montage.mp4"
# If this fails, $sped_file survives for manual recovery (re-run step 3 only).
if ! ffmpeg -loglevel warning \
# If music/overlay fails, the sped video is promoted to the output path so
# year-end-join can still include this movement (as a silent, no-overlay clip).
if ffmpeg -loglevel warning \
-i "$sped_file" -i "$music_file" \
-filter_complex \
"[0:v]fade=t=in:st=0:d=${FADE_DUR},fade=t=out:st=${fade_out_start}:d=${FADE_DUR},${DT}[vout];\
@@ -187,20 +188,20 @@ if ! ffmpeg -loglevel warning \
-map "[vout]" -map "[aout]" \
-c:v libx264 -pix_fmt yuv420p -c:a aac -b:a "$AUDIO_BITRATE" \
-t "$music_duration" -y "$output_file"; then
"$SCRIPT_DIR/notify.sh" "FAILED: montage step 3/3 (music+overlay) $SEASON Mvt$MVT_NUM ($ASTRO_YEAR)" \
"Music/overlay failed — sped video saved: $(basename "$sped_file")" || true
exit 1
rm -f "$sped_file"
echo "Done: $output_file"
"$SCRIPT_DIR/notify.sh" \
"Montage ready: $SEASON Mvt $MVT_NUM ($ASTRO_YEAR)" \
"$(basename "$output_file")${music_duration}s" \
|| true
else
mv "$sped_file" "$output_file"
echo "Music+overlay failed — silent video promoted to: $output_file"
"$SCRIPT_DIR/notify.sh" \
"WARNING: montage audio+overlay failed — $SEASON Mvt$MVT_NUM ($ASTRO_YEAR)" \
"Silent video saved as $(basename "$output_file") — re-run montage-mvt.sh to retry" || true
fi
rm -f "$sped_file"
echo "Done: $output_file"
# ── Notify ────────────────────────────────────────────────────────────────────
"$SCRIPT_DIR/notify.sh" \
"Montage ready: $SEASON Mvt $MVT_NUM ($ASTRO_YEAR)" \
"$(basename "$output_file")${music_duration}s" \
|| true # notifications are best-effort
# ── Trigger year-end join on last Autumn movement ────────────────────────────
if [ "$SEASON" = "Autumn" ] && [ "$MVT_NUM" = "3" ]; then
echo "Last movement of astronomical year $ASTRO_YEAR — triggering year-end join..."