Last active
July 13, 2021 15:18
-
-
Save mikegerber/1eed919481a5c96893181768bd8959db to your computer and use it in GitHub Desktop.
jpageviewer alias/function that looks for a mets.xml, i.e. in a OCR-D workspace. For use in `~/.zshrc` or similiar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_jpageviewer_jar=~/opt/jpageviewer/JPageViewer.jar | |
if [ -e "$_jpageviewer_jar" ]; then | |
jpageviewer() { | |
# --resolve-dir defaults to the file's directory | |
_jpageviewer_resolve_dir=`dirname "$1"` | |
# ... unless a mets.xml file exists one directory down (OCR-D workspace) | |
if [ -e "$_jpageviewer_resolve_dir"/../mets.xml ]; then | |
_jpageviewer_resolve_dir="$_jpageviewer_resolve_dir"/.. | |
fi | |
java \ | |
-Dhttp.proxyHost=http-proxy.sbb.spk-berlin.de -Dhttp.proxyPort=3128 \ | |
-jar $_jpageviewer_jar \ | |
--resolve-dir "$_jpageviewer_resolve_dir" \ | |
"$1" | |
unset _jpageviewer_resolve_dir | |
} | |
else | |
unset _jpageviewer_jar | |
fi |
If you're not at SBB, remove/change the -Dhttp.proxyHost=http-proxy.sbb.spk-berlin.de -Dhttp.proxyPort=3128 \
line.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have to copy the JPageViewer jar to the right directory. I symlinked
~/opt/jpageviewer
to~/opt/jpageviewer-1.4.01
, which contains the files from the official release: