mirror of
https://github.com/qurator-spk/ocrd-galley.git
synced 2025-07-04 02:39:51 +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 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
|
self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
|
||||||
# ppn=$1
|
make_workspace(ppn, ppn)
|
||||||
|
|
||||||
|
# XXX
|
||||||
|
# subprocess.run([
|
||||||
|
# os.path.join(self_dir, 'run-docker-hub'),
|
||||||
|
# '-I', 'BEST',
|
||||||
|
# '--skip-validation'
|
||||||
|
# ])
|
||||||
|
|
||||||
|
|
||||||
# From here, the magic happens
|
if __name__ == '__main__':
|
||||||
self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
|
ppn2ocr()
|
||||||
make_workspace(ppn, ppn)
|
|
||||||
# subprocess.run([
|
|
||||||
# os.path.join(self_dir, 'run-docker-hub'),
|
|
||||||
# '-I', 'BEST',
|
|
||||||
# '--skip-validation'
|
|
||||||
# ])
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
requests
|
requests
|
||||||
lxml
|
lxml
|
||||||
|
click
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue