mirror of
https://github.com/qurator-spk/ocrd-galley.git
synced 2025-06-07 22:00:12 +02:00
⚙️ ppn2ocr: Move pruning file groups into a function
This commit is contained in:
parent
6ae4bc8e3a
commit
91296ffa0e
1 changed files with 12 additions and 5 deletions
17
ppn2ocr
17
ppn2ocr
|
@ -78,6 +78,14 @@ def mime_type_for_format(format_):
|
||||||
return mime_type
|
return mime_type
|
||||||
|
|
||||||
|
|
||||||
|
def prune_file_grps(mets):
|
||||||
|
# XXX
|
||||||
|
# Delete PRESENTATION + LOCAL file groups
|
||||||
|
# (local file:/// or file:/ links, not handled well by "ocrd workspace")
|
||||||
|
remove_file_grp(mets, 'PRESENTATION')
|
||||||
|
remove_file_grp(mets, 'LOCAL')
|
||||||
|
|
||||||
|
|
||||||
def make_workspace(ppn, workspace):
|
def make_workspace(ppn, workspace):
|
||||||
# Make workspace directory
|
# Make workspace directory
|
||||||
os.mkdir(workspace)
|
os.mkdir(workspace)
|
||||||
|
@ -85,11 +93,6 @@ def make_workspace(ppn, workspace):
|
||||||
|
|
||||||
mets = oai_mets(ppn)
|
mets = oai_mets(ppn)
|
||||||
|
|
||||||
# XXX
|
|
||||||
# Delete PRESENTATION + LOCAL file groups
|
|
||||||
# (local file:/// or file:/ links, not handled well by "ocrd workspace")
|
|
||||||
remove_file_grp(mets, 'PRESENTATION')
|
|
||||||
remove_file_grp(mets, 'LOCAL')
|
|
||||||
|
|
||||||
|
|
||||||
# Delete MAX file group - we assume that, if it exists, it is not as
|
# Delete MAX file group - we assume that, if it exists, it is not as
|
||||||
|
@ -125,6 +128,10 @@ def make_workspace(ppn, workspace):
|
||||||
|
|
||||||
mets.find('//mets:fileSec', namespaces=XMLNS).append(file_grp_best)
|
mets.find('//mets:fileSec', namespaces=XMLNS).append(file_grp_best)
|
||||||
|
|
||||||
|
|
||||||
|
prune_file_grps(mets)
|
||||||
|
|
||||||
|
|
||||||
# Write mets.xml
|
# Write mets.xml
|
||||||
mets.write('mets.xml', pretty_print=True)
|
mets.write('mets.xml', pretty_print=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue