def get_metadata(stream):
 lrf = (stream if isinstance(stream, LRFMetaFile) else LRFMetaFile(stream))
 authors = string_to_authors(lrf.author)
 mi = MetaInformation(lrf.title.strip(), authors)
 mi.author = lrf.author.strip()
 mi.comments = lrf.free_text.strip()
 mi.category = ((lrf.category.strip() + ', ') + lrf.classification.strip())
 tags = [x.strip() for x in mi.category.split(',') if x.strip()]
 if tags:
  mi.tags = tags
 if (mi.category.strip() == ','):
  mi.category = None
 mi.publisher = lrf.publisher.strip()
 mi.cover_data = lrf.get_cover()
 try:
  mi.title_sort = lrf.title_reading.strip()
  if (not mi.title_sort):
   mi.title_sort = None
 except:
  pass
 try:
  mi.author_sort = lrf.author_reading.strip()
  if (not mi.author_sort):
   mi.author_sort = None
 except:
  pass
 if ((not mi.title) or ('unknown' in mi.title.lower())):
  mi.title = None
 if (not mi.authors):
  mi.authors = None
 if ((not mi.author) or ('unknown' in mi.author.lower())):
  mi.author = None
 if ((not mi.category) or ('unknown' in mi.category.lower())):
  mi.category = None
 if ((not mi.publisher) or ('unknown' in mi.publisher.lower()) or ('some publisher' in mi.publisher.lower())):
  mi.publisher = None
 return mi

def get_metadata ( stream ) : lrf = ( stream if isinstance ( stream , LRFMetaFile ) else LRFMetaFile ( stream ) ) authors = string_to_authors ( lrf . author ) mi = MetaInformation ( lrf . title . strip ( ) , authors ) mi . author = lrf . author . strip ( ) mi . comments = lrf . free_text . strip ( ) mi . category = ( ( lrf . category . strip ( ) + ', ' ) + lrf . classification . strip ( ) ) tags = [ x . strip ( ) for x in mi . category . split ( ',' ) if x . strip ( ) ] if tags : mi . tags = tags if ( mi . category . strip ( ) == ',' ) : mi . category = None mi . publisher = lrf . publisher . strip ( ) mi . cover_data = lrf . get_cover ( ) try : mi . title_sort = lrf . title_reading . strip ( ) if ( not mi . title_sort ) : mi . title_sort = None except : pass try : mi . author_sort = lrf . author_reading . strip ( ) if ( not mi . author_sort ) : mi . author_sort = None except : pass if ( ( not mi . title ) or ( 'unknown' in mi . title . lower ( ) ) ) : mi . title = None if ( not mi . authors ) : mi . authors = None if ( ( not mi . author ) or ( 'unknown' in mi . author . lower ( ) ) ) : mi . author = None if ( ( not mi . category ) or ( 'unknown' in mi . category . lower ( ) ) ) : mi . category = None if ( ( not mi . publisher ) or ( 'unknown' in mi . publisher . lower ( ) ) or ( 'some publisher' in mi . publisher . lower ( ) ) ) : mi . publisher = None return mi
returns dictionary of all host metadata .