Skip to content

Commit

Permalink
pre_clone_to_workdir: simplify/update
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky committed Dec 14, 2023
1 parent c297053 commit b60c647
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ocrd_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,17 @@ pre_clone_to_workdir() {
diff -u <(ocrd workspace -m "$METS_PATH" list-page) <(ocrd workspace -d "$WORKDIR" list-page)
else
# we cannot use ocrd workspace clone, because it does not offer copying local files
# (only download all remote or download nothing)
# (only download all remote or download nothing) core#1149
cp -v "$METS_PATH" "$WORKDIR"/mets.xml
rsync -T /tmp --exclude=$(basename "$METS_PATH") -av "$(dirname "$METS_PATH")"/ "$WORKDIR"
# now rename the input file grp to the OCR-D default
# (cannot use ocrd workspace rename-group due to core#913)
#ocrd workspace -d "$WORKDIR" rename-group $IMAGES_GRP OCR-D-IMG
xmlstarlet ed -L -N mods=http://www.loc.gov/mods/v3 -N mets=http://www.loc.gov/METS/ -N xlink=http://www.w3.org/1999/xlink \
-u "/mets:mets/mets:fileSec/mets:fileGrp[@USE='$IMAGES_GRP']/@USE" -v OCR-D-IMG "$WORKDIR/mets.xml"
# xmlstarlet ed -L -N mods=http://www.loc.gov/mods/v3 -N mets=http://www.loc.gov/METS/ -N xlink=http://www.w3.org/1999/xlink \
# -u "/mets:mets/mets:fileSec/mets:fileGrp[@USE='$IMAGES_GRP']/@USE" -v OCR-D-IMG "$WORKDIR/mets.xml"
mets-alias-filegrp -s input=$IMAGES_GRP -s output=OCR-D-IMG -i "$WORKDIR/mets.xml"
# now remove the output file grp, if it exists
ocrd workspace -d "$WORKDIR" remove-group -fr $RESULT_GRP
# workaround for core#485
ocrd workspace -d "$WORKDIR" remove -f FULLDOWNLOAD
fi
}

Expand Down

0 comments on commit b60c647

Please sign in to comment.