def submit_items(log, userkey, items, chunksize=64):
 data = []
 def submit_chunk():
  'Submit the current accumulated fingerprint data.'
  log.info(u'submitting {0} fingerprints', len(data))
  try:
   acoustid.submit(API_KEY, userkey, data)
  except acoustid.AcoustidError as exc:
   log.warning(u'acoustid submission error: {0}', exc)
  del data[:]
 for item in items:
  fp = fingerprint_item(log, item)
  item_data = {'duration': int(item.length), 'fingerprint': fp}
  if item.mb_trackid:
   item_data['mbid'] = item.mb_trackid
   log.debug(u'submitting MBID')
  else:
   item_data.update({'track': item.title, 'artist': item.artist, 'album': item.album, 'albumartist': item.albumartist, 'year': item.year, 'trackno': item.track, 'discno': item.disc})
   log.debug(u'submitting textual metadata')
  data.append(item_data)
  if (len(data) >= chunksize):
   submit_chunk()
 if data:
  submit_chunk()

def submit_items ( log , userkey , items , chunksize = 64 ) : data = [ ] def submit_chunk ( ) : log . info ( u'submitting {0} fingerprints' , len ( data ) ) try : acoustid . submit ( API_KEY , userkey , data ) except acoustid . AcoustidError as exc : log . warning ( u'acoustid submission error: {0}' , exc ) del data [ : ] for item in items : fp = fingerprint_item ( log , item ) item_data = { 'duration' : int ( item . length ) , 'fingerprint' : fp } if item . mb_trackid : item_data [ 'mbid' ] = item . mb_trackid log . debug ( u'submitting MBID' ) else : item_data . update ( { 'track' : item . title , 'artist' : item . artist , 'album' : item . album , 'albumartist' : item . albumartist , 'year' : item . year , 'trackno' : item . track , 'discno' : item . disc } ) log . debug ( u'submitting textual metadata' ) data . append ( item_data ) if ( len ( data ) >= chunksize ) : submit_chunk ( ) if data : submit_chunk ( )
submit fingerprints for the items to the acoustid server .