From 78f632a523b488af5e9039c8b6c73696f040f924 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Mon, 9 Mar 2020 12:26:38 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20--input-file-grp/-I=20com?= =?UTF-8?q?mand=20line=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- my_ocrd_workflow | 15 ++++++++++++++- run | 2 +- run-docker-hub | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b69b9a6..8b8b7e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,4 +79,4 @@ COPY xsd/* /usr/share/xml/ WORKDIR /data -CMD ["/usr/bin/my_ocrd_workflow"] +ENTRYPOINT ["/usr/bin/my_ocrd_workflow"] diff --git a/my_ocrd_workflow b/my_ocrd_workflow index 5522fdf..9d380cd 100755 --- a/my_ocrd_workflow +++ b/my_ocrd_workflow @@ -6,6 +6,19 @@ set -e # Abort on error export LOG_LEVEL=${LOG_LEVEL:-DEBUG} # /etc/ocrd_logging.py uses this to set level for all OCR-D modules export TEXTEQUIV_LEVEL=glyph +# Command line parameters +OPTS=`getopt -o I: --long input-file-grp: -- "$@"` +eval set -- "$OPTS" +INPUT_FILE_GRP=OCR-D-IMG +while true; do + case "$1" in + -I|--input-file-grp) INPUT_FILE_GRP=$2; shift 2;; + + --) shift; break;; + *) break;; + esac +done + # Set up logging if [ "$LOG_LEVEL" = "DEBUG" -o "$LOG_LEVEL" = "TRACE" ]; then set -x @@ -44,7 +57,7 @@ do_binarization() { }' ocrd workspace remove-group -rf OCR-D-IMG-BINPAGE ocrd workspace remove-group -rf OCR-D-IMG-BIN - ocrd-olena-binarize -I OCR-D-IMG -O OCR-D-IMG-BINPAGE,OCR-D-IMG-BIN -p "$ocrd_olena_binarize_parameters" + ocrd-olena-binarize -I $INPUT_FILE_GRP -O OCR-D-IMG-BINPAGE,OCR-D-IMG-BIN -p "$ocrd_olena_binarize_parameters" } do_linesegmentation_tesserocr() { diff --git a/run b/run index d47dd52..14277a2 100755 --- a/run +++ b/run @@ -19,4 +19,4 @@ docker run --privileged=true --rm -t \ --mount type=bind,src="$(pwd)",target=/data \ \ -e LOG_LEVEL=$LOG_LEVEL \ - $DOCKER_IMAGE + $DOCKER_IMAGE "$@" diff --git a/run-docker-hub b/run-docker-hub index 9076c93..9e4339e 100755 --- a/run-docker-hub +++ b/run-docker-hub @@ -1,4 +1,4 @@ #!/bin/sh # Run the my_ocrd_workflow container on the current workspace -DOCKER_IMAGE=mikegerber/my_ocrd_workflow:stable `dirname $0`/run +DOCKER_IMAGE=mikegerber/my_ocrd_workflow:stable `dirname $0`/run "$@"