|
|
@ -11,8 +11,8 @@ from copy import deepcopy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XMLNS = {
|
|
|
|
XMLNS = {
|
|
|
|
'mets': 'http://www.loc.gov/METS/',
|
|
|
|
'mets': 'http://www.loc.gov/METS/',
|
|
|
|
'xlink': 'http://www.w3.org/1999/xlink'
|
|
|
|
'xlink': 'http://www.w3.org/1999/xlink'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
API_URL = 'https://oai.sbb.berlin'
|
|
|
|
API_URL = 'https://oai.sbb.berlin'
|
|
|
|
IDENTIFIER_TEMPLATE = 'oai:digital.staatsbibliothek-berlin.de:%s'
|
|
|
|
IDENTIFIER_TEMPLATE = 'oai:digital.staatsbibliothek-berlin.de:%s'
|
|
|
@ -93,8 +93,8 @@ def prune_file_grps(mets):
|
|
|
|
wanted_file_grps = ["MAX", "FULLTEXT"]
|
|
|
|
wanted_file_grps = ["MAX", "FULLTEXT"]
|
|
|
|
|
|
|
|
|
|
|
|
for u in mets.xpath('//mets:fileGrp/@USE', namespaces=XMLNS):
|
|
|
|
for u in mets.xpath('//mets:fileGrp/@USE', namespaces=XMLNS):
|
|
|
|
if u not in wanted_file_grps:
|
|
|
|
if u not in wanted_file_grps:
|
|
|
|
remove_file_grp(mets, u)
|
|
|
|
remove_file_grp(mets, u)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def make_workspace(ppn, workspace):
|
|
|
|
def make_workspace(ppn, workspace):
|
|
|
@ -115,7 +115,7 @@ def make_workspace(ppn, workspace):
|
|
|
|
file_grp_default = mets.find('//mets:fileGrp[@USE="DEFAULT"]', namespaces=XMLNS)
|
|
|
|
file_grp_default = mets.find('//mets:fileGrp[@USE="DEFAULT"]', namespaces=XMLNS)
|
|
|
|
|
|
|
|
|
|
|
|
if file_grp_default is None:
|
|
|
|
if file_grp_default is None:
|
|
|
|
raise ValueError("This document has no DEFAULT file group, could be a multi-volume work")
|
|
|
|
raise ValueError("This document has no DEFAULT file group, could be a multi-volume work")
|
|
|
|
|
|
|
|
|
|
|
|
file_grp_best = deepcopy(file_grp_default)
|
|
|
|
file_grp_best = deepcopy(file_grp_default)
|
|
|
|
|
|
|
|
|
|
|
|