def getVariables(self): """ Get all required vars from command line + config and confirm their existence. """ process_path = self.command_line.process_path mets_file_name = self.getConfigItem("metadata_goobi_file", None, self.process_files_section) self.mets_file = os.path.join(process_path, mets_file_name) process_path = self.command_line.process_path pdf_input = self.getConfigItem("doc_limbpdf_path", section=self.folder_structure_section) pdf_output = self.getConfigItem("doc_pdf_path", section=self.folder_structure_section) # Create paths for self.pdf_input_dir = os.path.join(process_path, pdf_input) self.pdf_output_dir = os.path.join(process_path, pdf_output) # raises exception if one of our directories is missing tools.ensureDirsExist(self.pdf_input_dir, self.pdf_output_dir) tools.ensureFilesExist(self.mets_file)
def getVariables(self): ''' Ensure we have the variables necessary to execute the script Tools will throw an Exception otherwise ''' process_path = self.command_line.process_path mets_file_name = self.getConfigItem('metadata_goobi_file', None, 'process_files') self.mets_file = os.path.join(process_path, mets_file_name) self.ojs_root = self.getConfigItem('ojs_root') ojs_metadata_dir = self.getConfigItem('metadata_ojs_path', None, 'process_folder_structure') self.ojs_metadata_dir = os.path.join(process_path, ojs_metadata_dir) pdf_path = self.getConfigItem('doc_limbpdf_path', None, 'process_folder_structure') abs_pdf_path = os.path.join(process_path, pdf_path) self.pdf_name = tools.getFirstFileWithExtension(abs_pdf_path, '.pdf') self.pdf_file = os.path.join(abs_pdf_path, self.pdf_name) # TODO: check files in 'doc_pdf_path' instead of 'doc_limbpdf_path' # 'doc_limbpdf_path' contains the splitted pdf-files tools.ensureFilesExist(self.mets_file) tools.ensureDirsExist(self.ojs_metadata_dir) # parse boolean from command line self.overlapping_articles = self.getSetting('overlapping_articles', bool, default=True) # Get path to generate ojs_dir -> system means "define it from system variables" self.ojs_journal_path = self.getSetting('ojs_journal_path', default='system') # we also need the required issue fields req_fields = self.getConfigItem('issue_required_fields') self.issue_required_fields = req_fields.split(';') opt_fields = self.getConfigItem('issue_optional_fields') self.issue_optional_fields = opt_fields.split(';') # Set namespaces self.mets_ns = 'http://www.loc.gov/METS/' self.goobi_ns = 'http://meta.goobi.org/v1.5.1/' # Set sections self.front_matter = [] self.articles = [] self.back_matter = []