mirror of
https://github.com/qurator-spk/ocrd-galley.git
synced 2025-06-09 06:39:53 +02:00
💄 ppn2ocr: Add a proper CLI interface
This commit is contained in:
parent
70eb73e4c7
commit
4e19e2a655
2 changed files with 25 additions and 22 deletions
46
ppn2ocr
46
ppn2ocr
|
@ -6,6 +6,7 @@ import sys
|
|||
import lxml.etree as ET
|
||||
import re
|
||||
import subprocess
|
||||
import click
|
||||
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
|
||||
|
||||
|
||||
# Command line parameters
|
||||
# XXX
|
||||
ppn = sys.argv[1]
|
||||
# OPTS=`getopt -o h --long help -- "$@"`
|
||||
# eval set -- "$OPTS"
|
||||
# while true; do
|
||||
# case "$1" in
|
||||
# -h|--help) show_help; exit; shift;;
|
||||
# --) shift; break;;
|
||||
# *) break;;
|
||||
# esac
|
||||
# done
|
||||
# if [ -z "$1" ]; then show_help; exit; fi
|
||||
# ppn=$1
|
||||
@click.command()
|
||||
@click.argument('ppn')
|
||||
def ppn2ocr(ppn):
|
||||
"""
|
||||
Get METS with best images for a document PPN
|
||||
|
||||
For example, to get the document "PROPOSITIONES PHILOSOPHICAE: [...]" use this:
|
||||
|
||||
\b
|
||||
ppn2ocr PPN699887615
|
||||
ls PPN699887615
|
||||
"""
|
||||
self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
|
||||
make_workspace(ppn, ppn)
|
||||
|
||||
# XXX
|
||||
# subprocess.run([
|
||||
# os.path.join(self_dir, 'run-docker-hub'),
|
||||
# '-I', 'BEST',
|
||||
# '--skip-validation'
|
||||
# ])
|
||||
|
||||
|
||||
# From here, the magic happens
|
||||
self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
|
||||
make_workspace(ppn, ppn)
|
||||
# subprocess.run([
|
||||
# os.path.join(self_dir, 'run-docker-hub'),
|
||||
# '-I', 'BEST',
|
||||
# '--skip-validation'
|
||||
# ])
|
||||
if __name__ == '__main__':
|
||||
ppn2ocr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue