def extractMetadata(parser, quality=QUALITY_NORMAL):
 try:
  extractor = extractors[parser.__class__]
 except KeyError:
  return None
 metadata = extractor(quality)
 try:
  metadata.extract(parser)
 except HACHOIR_ERRORS as err:
  error(('Error during metadata extraction: %s' % unicode(err)))
 if metadata:
  metadata.mime_type = parser.mime_type
  metadata.endian = endian_name[parser.endian]
 return metadata

def extractMetadata ( parser , quality = QUALITY_NORMAL ) : try : extractor = extractors [ parser . __class__ ] except KeyError : return None metadata = extractor ( quality ) try : metadata . extract ( parser ) except HACHOIR_ERRORS as err : error ( ( 'Error during metadata extraction: %s' % unicode ( err ) ) ) if metadata : metadata . mime_type = parser . mime_type metadata . endian = endian_name [ parser . endian ] return metadata
create a metadata class from a parser .