💄 ppn2ocr: Add a proper CLI interface

pull/27/head
Gerber, Mike 5 years ago
parent 70eb73e4c7
commit 4e19e2a655

@ -6,6 +6,7 @@ import sys
import lxml.etree as ET import lxml.etree as ET
import re import re
import subprocess import subprocess
import click
from copy import deepcopy from copy import deepcopy
@ -130,27 +131,28 @@ def make_workspace(ppn, workspace):
#sed -i 's#file:///goobi/tiff001/sbb/#file:///srv/digisam_images/sbb/#g' mets.xml #sed -i 's#file:///goobi/tiff001/sbb/#file:///srv/digisam_images/sbb/#g' mets.xml
# Command line parameters @click.command()
# XXX @click.argument('ppn')
ppn = sys.argv[1] def ppn2ocr(ppn):
# OPTS=`getopt -o h --long help -- "$@"` """
# eval set -- "$OPTS" Get METS with best images for a document PPN
# while true; do
# case "$1" in For example, to get the document "PROPOSITIONES PHILOSOPHICAE: [...]" use this:
# -h|--help) show_help; exit; shift;;
# --) shift; break;; \b
# *) break;; ppn2ocr PPN699887615
# esac ls PPN699887615
# done """
# if [ -z "$1" ]; then show_help; exit; fi
# ppn=$1
# From here, the magic happens
self_dir = os.path.realpath(os.path.dirname(sys.argv[0])) self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
make_workspace(ppn, ppn) make_workspace(ppn, ppn)
# XXX
# subprocess.run([ # subprocess.run([
# os.path.join(self_dir, 'run-docker-hub'), # os.path.join(self_dir, 'run-docker-hub'),
# '-I', 'BEST', # '-I', 'BEST',
# '--skip-validation' # '--skip-validation'
# ]) # ])
if __name__ == '__main__':
ppn2ocr()

@ -1,2 +1,3 @@
requests requests
lxml lxml
click

Loading…
Cancel
Save