From 89595c606139a956d8ca63f83812df1e3e20166c Mon Sep 17 00:00:00 2001
From: Michelle Weidling <weidling@sub.uni-goettingen.de>
Date: Thu, 20 Apr 2023 10:41:51 +0200
Subject: [PATCH] fix: check if mets.xml has already been processed

---
 workflows/execute_workflows.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/workflows/execute_workflows.sh b/workflows/execute_workflows.sh
index 864faf5..9d54ad5 100755
--- a/workflows/execute_workflows.sh
+++ b/workflows/execute_workflows.sh
@@ -91,10 +91,12 @@ execute_wfs_and_extract_benchmarks() {
     # for all data sets…
     for WS_DIR in "$WORKSPACE_DIR"/*
     do
-        if [ -d "$WS_DIR" ]; then
+        INNER_DIR=$(ls "$WS_DIR"/data/)
+
+        if [ -d "$WS_DIR" ] &&  ! grep -q "OCR-D-OCR" "$WS_DIR/data/$INNER_DIR/mets.xml" ; then
             echo "Switching to $WS_DIR."
 
-            DIR_NAME=$(basename $WS_DIR)
+            DIR_NAME=$(basename "$WS_DIR")
 
             run "$WS_DIR"/data/*/*ocr.txt.nf "$DIR_NAME" "$WS_DIR"
             run "$WS_DIR"/data/*/*eval.txt.nf "$DIR_NAME" "$WS_DIR"
-- 
GitLab