mirror of
				https://github.com/qurator-spk/ocrd-galley.git
				synced 2025-10-31 19:24:12 +01:00 
			
		
		
		
	🚧 ppn2ocr: Properly remove the PRESENTATION file group
This commit is contained in:
		
							parent
							
								
									014e70fe35
								
							
						
					
					
						commit
						f893b339c5
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		
							
								
								
									
										11
									
								
								ppn2ocr
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								ppn2ocr
									
										
									
									
									
								
							|  | @ -70,6 +70,14 @@ def iiif_url_for_dms_url(dms_url, ppn, size): | |||
|     return iiif_url | ||||
| 
 | ||||
| 
 | ||||
| def remove_file_grp(mets, use): | ||||
|     for bad_fileid in mets.xpath(f'//mets:fileGrp[@USE="{use}"]/mets:file/@ID', namespaces=XMLNS): | ||||
|         for bad in mets.xpath(f'//mets:fptr[@FILEID="{bad_fileid}"]', namespaces=XMLNS): | ||||
|             bad.getparent().remove(bad) | ||||
|     for bad in mets.xpath(f'//mets:fileGrp[@USE="{use}"]', namespaces=XMLNS): | ||||
|         bad.getparent().remove(bad) | ||||
| 
 | ||||
| 
 | ||||
| def make_workspace(ppn, workspace): | ||||
|     # Make workspace directory | ||||
|     os.mkdir(workspace) | ||||
|  | @ -80,8 +88,7 @@ def make_workspace(ppn, workspace): | |||
|     # XXX | ||||
|     # Delete PRESENTATION file group | ||||
|     # (local file:/// links, not handled well by "ocrd workspace") | ||||
|     for bad in mets.xpath('//mets:fileGrp[@USE="PRESENTATION"]', namespaces=XMLNS): | ||||
|         bad.getparent().remove(bad) | ||||
|     remove_file_grp(mets, 'PRESENTATION') | ||||
| 
 | ||||
| 
 | ||||
|     # Duplicate DEFAULT file group into a new file group BEST | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue