aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/processTobiiRecords.sh49
1 files changed, 28 insertions, 21 deletions
diff --git a/utils/processTobiiRecords.sh b/utils/processTobiiRecords.sh
index ebbded6..aca1543 100644
--- a/utils/processTobiiRecords.sh
+++ b/utils/processTobiiRecords.sh
@@ -1,32 +1,39 @@
#! /bin/bash
#
-# Load json ArGaze context file ($1) then, look for all Tobii record segments into input folder ($2).
+# Look for all Tobii record segments into input folder ($1) to execute an ArGaze context file ($2) on each.
#
-# For each Tobii record segment found:
-# - context "segment" field is modified to bind on it,
-# - context "pipeline" field is modified to bind on a temporary patched pipeline \
-# resulting from the merging of the given pipeline and an optionnal "patch.json" file in Tobii record segment,
-# - pipeline "projection_cache" field is added to create or bind a "layers_projection.csv" file in segment folder,
-# - then, ArGaze executes the modified context from output folder ($3) to export all records into it,
-# - finally, context and pipeline files are resetted and temporary patched pipeline is removed.
+# For each Tobii record segment found a temporary context and pipeline files are created:
+# - temporary context "segment" field is modified to bind on it,
+# - temporary context "pipeline" field is modified to bind on a temporary pipeline file,
+# - temporary pipeline "projection_cache" field is added to create or bind a "layers_projection.csv" file in segment folder,
+# — if a "patch.json" file exist in the Tobii record segment, it merged to the temporary pipeline file,
+# - then, ArGaze executes the temporary context from output folder ($3) to export all records into it,
+# - finally, temporary context and pipeline files are deleted.
#
# Arguments:
-# $1: ArGaze context file
-# $2: folder from where to look for Tobii records
+# $1: folder from where to look for Tobii records
+# $2: ArGaze context file
# $3: folder where to export processing outputs
+# $4+: any other arguments are passed to "argaze load" command
#######################################
-# Check required arguments
-if [ "$#" -ne 3 ]; then
- echo "!!! Incorrect number of arguments"
- exit 1
-fi
+# Parse mandatory arguments
+input_folder="$(realpath "$1")"
+context_file="$(realpath "$2")"
+output_folder="$(realpath "$3")"
+
+# Parse any other arguments to pass them to "argaze load" command
+if [ $# -ge 4 ]; then
+
+ argaze_args=$4
-context_file=$1
-input_folder=$2
-output_folder=$3
+ while shift && [ -n "$4" ]; do
+ argaze_args="${argaze_args},$4"
+ done
+
+fi
-# Check requirements:
+# Check requirements
if brew ls --versions jq > /dev/null; then
: # jq installed
else
@@ -104,7 +111,7 @@ function process_segment() {
# Launch modified context with argaze load command
echo "*** ArGaze starts context"
- python -m argaze load "$ctx_folder/$temp_context_file"
+ python -m argaze load "$ctx_folder/$temp_context_file" $argaze_args
echo "*** ArGaze ends context"
@@ -143,7 +150,7 @@ function process_record() {
done
}
-echo "*** Looking for Tobii records into $2 folder"
+echo "*** Looking for Tobii records into $1 folder"
# Check if the path is directly a path to a record segment
if [ -f "$input_folder/livedata.json.gz" ]; then