|
|
|
@ -78,6 +78,14 @@ def mime_type_for_format(format_):
|
|
|
|
|
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):
|
|
|
|
|
# Make workspace directory
|
|
|
|
|
os.mkdir(workspace)
|
|
|
|
@ -85,11 +93,6 @@ def make_workspace(ppn, workspace):
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
@ -125,6 +128,10 @@ def make_workspace(ppn, workspace):
|
|
|
|
|
|
|
|
|
|
mets.find('//mets:fileSec', namespaces=XMLNS).append(file_grp_best)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prune_file_grps(mets)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Write mets.xml
|
|
|
|
|
mets.write('mets.xml', pretty_print=True)
|
|
|
|
|
|
|
|
|
|