def getImageInformation(self): valid_exts = self.settings['valid_exts'] # Get paths to all images file_paths = [os.path.join(self.source_folder,f) for f in sorted(os.listdir(self.source_folder)) if os.path.splitext(f)[-1].strip('.') in valid_exts] # break if no images in folder if len(file_paths) == 0: return # place binding in a separate list if self.settings['has_binding']: self.bindings = [file_paths[0]]+[file_paths[-1]] file_paths = file_paths[1:-1] for p in file_paths: img_size = fs.getFileSize(p) img_w,img_h = image_tools.getImageDimensions(p) self.img_proc_info['images'][p] = {'crop_coordinates':{}, 'image_width':img_w, 'image_height':img_h, 'file_size': img_size, 'deskew_angle':0, 'r_crop':True, # right margin crop? 't_crop':True, # top margin crop? 'l_crop':True, # left margin crop? 'b_crop':True, # bottom margin crop? 'deskew': self.settings['deskew_images'], # deskew image? 'crop': self.settings['crop_images'], # deskew image? 'spread':False, # is image a spread (opslag)? }
def getVariables(self): # Collect parameters for aleph-script process_title = self.command_line.process_title process_path = self.command_line.process_path # Extract barcode from title if '_' in process_title: self.barcode = process_title.split('_')[0] else: self.barcode = process_title # get color_pdf self.color_pdf = self.barcode+'_color'+'.pdf' # get color pdf size c_pdf_path = self.getConfigItem('doc_pdf_color_path',section=self.folder_structure_section) color_pdf_file = os.path.join(process_path, c_pdf_path)+self.color_pdf self.color_pdf_size = fs.getFileSize(color_pdf_file,mb=True) # get bw_pdf self.bw_pdf = self.barcode+'_bw'+'.pdf' # get bw_pdf_size bw_pdf_path = self.getConfigItem('doc_pdf_bw_path',section=self.folder_structure_section) bw_pdf_file = os.path.join(process_path, bw_pdf_path)+self.bw_pdf self.bw_pdf_size = fs.getFileSize(bw_pdf_file,mb=True) # Get multivolume status - cast value to bool. # Assign string 'multivolumes' if true, otherwise assign '' is_multivolume = self.getSetting('is_multivolume',var_type = bool, default = False) if is_multivolume: self.multivolumes = 'multivolumes' else: self.multivolumes = '' # get user and server from config to run the script self.aleph_server_user = self.getSetting('aleph_server_user') self.aleph_server = self.getSetting('aleph_server')