def download_cover(log, title=None, authors=None, identifiers={}, timeout=30):
 rq = Queue()
 abort = Event()
 run_download(log, rq, abort, title=title, authors=authors, identifiers=identifiers, timeout=timeout, get_best_cover=True)
 results = []
 while True:
  try:
   results.append(rq.get_nowait())
  except Empty:
   break
 cp = msprefs[u'cover_priorities']
 def keygen(result):
  (plugin, width, height, fmt, data) = result
  return (cp.get(plugin.name, 1), (1 / (width * height)))
 results.sort(key=keygen)
 return (results[0] if results else None)

def download_cover ( log , title = None , authors = None , identifiers = { } , timeout = 30 ) : rq = Queue ( ) abort = Event ( ) run_download ( log , rq , abort , title = title , authors = authors , identifiers = identifiers , timeout = timeout , get_best_cover = True ) results = [ ] while True : try : results . append ( rq . get_nowait ( ) ) except Empty : break cp = msprefs [ u'cover_priorities' ] def keygen ( result ) : ( plugin , width , height , fmt , data ) = result return ( cp . get ( plugin . name , 1 ) , ( 1 / ( width * height ) ) ) results . sort ( key = keygen ) return ( results [ 0 ] if results else None )
synchronous cover download .