|
|
@ -91,7 +91,6 @@ def make_workspace(ppn, workspace):
|
|
|
|
remove_file_grp(mets, 'PRESENTATION')
|
|
|
|
remove_file_grp(mets, 'PRESENTATION')
|
|
|
|
remove_file_grp(mets, 'LOCAL')
|
|
|
|
remove_file_grp(mets, 'LOCAL')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Duplicate DEFAULT file group into a new file group BEST
|
|
|
|
# Duplicate DEFAULT file group into a new file group BEST
|
|
|
|
format_ = 'tif'
|
|
|
|
format_ = 'tif'
|
|
|
|
file_grp_default = mets.find('//mets:fileGrp[@USE="DEFAULT"]', namespaces=XMLNS)
|
|
|
|
file_grp_default = mets.find('//mets:fileGrp[@USE="DEFAULT"]', namespaces=XMLNS)
|
|
|
@ -117,7 +116,6 @@ 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Write mets.xml
|
|
|
|
# Write mets.xml
|
|
|
|
mets.write('mets.xml', pretty_print=True)
|
|
|
|
mets.write('mets.xml', pretty_print=True)
|
|
|
|
|
|
|
|
|
|
|
@ -134,11 +132,13 @@ def make_workspace(ppn, workspace):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validate_ppn(ctx, param, value):
|
|
|
|
def validate_ppn(ctx, param, value):
|
|
|
|
|
|
|
|
"""Validate a PPN argument"""
|
|
|
|
if not value.startswith('PPN'):
|
|
|
|
if not value.startswith('PPN'):
|
|
|
|
raise click.BadParameter('PPN must be in format PPNxxxxxxxx')
|
|
|
|
raise click.BadParameter('PPN must be in format PPNxxxxxxxx')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.command()
|
|
|
|
@click.command()
|
|
|
|
@click.argument('ppn', callback=validate_ppn)
|
|
|
|
@click.argument('ppn', callback=validate_ppn)
|
|
|
|
def ppn2ocr(ppn):
|
|
|
|
def ppn2ocr(ppn):
|
|
|
|