#!/usr/bin/env bash
set -euo pipefail
PROJECT=/data/video-pipeline/Youtube-Video-Maker/Project/12062026-001-Nha-Tien-Le
cd /data/video-pipeline/Youtube-Video-Maker
while kill -0 4540 2>/dev/null; do sleep 30; done
./.venv/bin/python "$PROJECT/scripts_run_step_06_images.py"
./.venv/bin/python - <<'PY'
import json, datetime
from pathlib import Path
p=Path('/data/video-pipeline/Youtube-Video-Maker/Project/12062026-001-Nha-Tien-Le/checklist_19_steps.json')
d=json.loads(p.read_text(encoding='utf-8'))
d['current_step']=6; d['updated_at']=datetime.datetime.now().isoformat(timespec='seconds')
for st in d['steps']:
    if st['step']<=6:
        st['status']='completed'; st['completed_at']=st.get('completed_at') or d['updated_at']
p.write_text(json.dumps(d,ensure_ascii=False,indent=2),encoding='utf-8')
PY
