mirror of
https://github.com/qurator-spk/ocrd-galley.git
synced 2025-07-01 01:19:52 +02:00
🚧 Prepare supporting ocrd-sbb-binarize
ocrd-sbb-binarize seems to work but its input does not work with ocrd-sbb-textline-detector: https://github.com/qurator-spk/sbb_binarization/issues/8 https://github.com/qurator-spk/sbb_textline_detection/issues/47
This commit is contained in:
parent
053fc0bc34
commit
0841af5491
6 changed files with 57 additions and 6 deletions
|
@ -62,13 +62,37 @@ annex_get() {
|
|||
)
|
||||
}
|
||||
|
||||
# Options:
|
||||
# --no-unpack Do NOT unpack the file
|
||||
# --strip-components NUMBER (as tar's option)
|
||||
download_to() {
|
||||
unpack=1
|
||||
if [[ "$1" = '--no-unpack' ]]; then
|
||||
unpack=0
|
||||
shift
|
||||
tar_options=""
|
||||
|
||||
_options=$(getopt --long no-unpack,strip-components: -- "" "$@")
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Bad parameters for download_to" >&2
|
||||
exit 1
|
||||
fi
|
||||
file_pattern="$1"
|
||||
eval set -- "$_options"
|
||||
while true; do
|
||||
case "$1" in
|
||||
--no-unpack)
|
||||
unpack=0
|
||||
;;
|
||||
--strip-components)
|
||||
shift
|
||||
components=$1
|
||||
tar_options="$tar_options --strip-components $components"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
download_source="$1"
|
||||
dest="$2"
|
||||
|
||||
|
@ -79,7 +103,7 @@ download_to() {
|
|||
if [[ $unpack = 1 ]]; then
|
||||
mkdir -p "$dest"
|
||||
# Unpacking relies on tar -a unpacking any tar compression
|
||||
tar -C "$dest" -af $tmpf -xv
|
||||
tar -C "$dest" $tar_options -af $tmpf -xv
|
||||
rm -f $tmpf
|
||||
else
|
||||
dest_dir=`dirname "$dest"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue