def step( self ): error = None jhove = Jhove( self.config.jhove.file, self.config.jhove.conf ) details = jhove.checkFolder( self.command_line.original_tiff_path, Jhove.FILETYPE.TIFF ) tiffs_failed = [] for tiff_file in details: if not details[tiff_file]['ok']: tiffs_failed.append( tiff_file ) if tiffs_failed: # Create error message error = "There was a problem with " + str( len( tiffs_failed ) ) + " tiff files. Details follow. \n" for tiff in tiffs_failed: error += 'Tiff "' + tiff + '" failed' error += ", " + details[tiff]['status'] messages = [] for message in details[tiff]['messages'] : messages.append( '"' + message + '"' ) if messages: error += " - " + ", ".join( messages ) error += "\n" # self.error( error ) return error
def step( self ): error = None # Get jpeg path and check jpeg_path = self.command_line.tiff_path.replace( '_tif', '_jp2' ) if self.checkFolder( jpeg_path ) == None : jhove = Jhove( self.config.jhove.file, self.config.jhove.conf ) details = jhove.checkFolder( jpeg_path, Jhove.FILETYPE.JPEG2000 ) files_failed = [] for file in details: if not details[file]['ok']: files_failed.append( file ) if files_failed: # Create error message error = "There was a problem with " + str( len( files_failed ) ) + " jpeg2000 files. Details follow. \n" for file in files_failed: error += 'Jpeg2000 "' + file + '" failed' error += ", " + details[file]['status'] messages = [] for message in details[file]['messages'] : messages.append( '"' + message + '"' ) if messages: error += " - " + ", ".join( messages ) error += "\n" # self.error( error ) else: error = "Jpeg2000 folder " + jpeg_path + " does not exist" return error