def fingerprint_item(log, item, write=False):
 if (not item.length):
  log.info(u'{0}: no duration available', util.displayable_path(item.path))
 elif item.acoustid_fingerprint:
  if write:
   log.info(u'{0}: fingerprint exists, skipping', util.displayable_path(item.path))
  else:
   log.info(u'{0}: using existing fingerprint', util.displayable_path(item.path))
   return item.acoustid_fingerprint
 else:
  log.info(u'{0}: fingerprinting', util.displayable_path(item.path))
  try:
   (_, fp) = acoustid.fingerprint_file(item.path)
   item.acoustid_fingerprint = fp
   if write:
    log.info(u'{0}: writing fingerprint', util.displayable_path(item.path))
    item.try_write()
   if item._db:
    item.store()
   return item.acoustid_fingerprint
  except acoustid.FingerprintGenerationError as exc:
   log.info(u'fingerprint generation failed: {0}', exc)

def fingerprint_item ( log , item , write = False ) : if ( not item . length ) : log . info ( u'{0}: no duration available' , util . displayable_path ( item . path ) ) elif item . acoustid_fingerprint : if write : log . info ( u'{0}: fingerprint exists, skipping' , util . displayable_path ( item . path ) ) else : log . info ( u'{0}: using existing fingerprint' , util . displayable_path ( item . path ) ) return item . acoustid_fingerprint else : log . info ( u'{0}: fingerprinting' , util . displayable_path ( item . path ) ) try : ( _ , fp ) = acoustid . fingerprint_file ( item . path ) item . acoustid_fingerprint = fp if write : log . info ( u'{0}: writing fingerprint' , util . displayable_path ( item . path ) ) item . try_write ( ) if item . _db : item . store ( ) return item . acoustid_fingerprint except acoustid . FingerprintGenerationError as exc : log . info ( u'fingerprint generation failed: {0}' , exc )
get the fingerprint for an item .