#!/bin/bash
BASE="/home/zyw/Downloads/dl-hub/25-软件测试方法和技术第4版OCR整理/讲稿"
CONC=${CONC:-2}
cd "$BASE"
run_one(){
  ch=$1; a=$2; b=$3
  out="_polish/batches/ch${ch}-${a}-${b}.out.md"
  [ -s "$out" ] && { echo "SKIP $ch $a-$b" >> _polish/queue.log; return 0; }
  bash _polish/run_one_batch.sh "$ch" "$a" "$b" >> _polish/queue.log 2>&1
  if [ -s "$out" ]; then
    /home/zyw/Downloads/dl-hub/23-拍照OCR取字/.venv/bin/python _polish/check_batch.py "$ch" "$a" "$b" >> _polish/queue.log 2>&1 || true
  fi
}
export -f run_one
grep -vE '^5 (21|41|61|81) ' _polish/batch_plan.txt | xargs -P "$CONC" -L1 bash -c 'run_one $0 $1 $2'
echo "ALL DONE" >> _polish/queue.log
