def process_cli(log_level, mets, page_id, tasks): """ Process a series of tasks """ log = getLogger('ocrd.cli.process') run_tasks(mets, log_level, page_id, tasks) log.info("Finished")
def test_task_run(self): resolver = Resolver() with copy_of_directory( assets.path_to('kant_aufklaerung_1784/data')) as wsdir: with pushd_popd(wsdir): ws = resolver.workspace_from_url('mets.xml') ws.add_file('GRP0', content='', local_filename='GRP0/foo', ID='file0', mimetype=MIMETYPE_PAGE, pageId=None) ws.save_mets() files_before = len(ws.mets.find_files()) run_tasks('mets.xml', 'DEBUG', None, [ "dummy -I OCR-D-IMG -O GRP1", "dummy -I GRP1 -O GRP2", ]) ws.reload_mets() # step 1: 2 images in OCR-D-IMG -> 2 images 2 PAGEXML in GRP1 # step 2: 2 images and 2 PAGEXML in GRP1 -> process just the PAGEXML self.assertEqual(len(ws.mets.find_files()), files_before + 6)