ppn2ocr: Keep only wanted file groups

master
Gerber, Mike 3 years ago
parent 91296ffa0e
commit f197f01d3f

@ -79,11 +79,22 @@ def mime_type_for_format(format_):
def prune_file_grps(mets): def prune_file_grps(mets):
# XXX """
# Delete PRESENTATION + LOCAL file groups Prune unwanted file groups
# (local file:/// or file:/ links, not handled well by "ocrd workspace")
remove_file_grp(mets, 'PRESENTATION') We only want to keep the MAX file group (we created it ourselves) and
remove_file_grp(mets, 'LOCAL') possibly ABBYY full texts in FULLTEXT.
For the PRESENTATION + LOCAL file groups we definitely want to delete
because they contain local file:/// or file:/ links, which are not handled
well by "ocrd workspace". They are not explicitly mentioned, as we
only keep a whitelist.
"""
wanted_file_grps = ["MAX", "FULLTEXT"]
for u in mets.xpath('//mets:fileGrp/@USE', namespaces=XMLNS):
if u not in wanted_file_grps:
remove_file_grp(mets, u)
def make_workspace(ppn, workspace): def make_workspace(ppn, workspace):

Loading…
Cancel
Save