parameters: (self, user, force_coll_name, infos, stream, filename, total_size, num_recs)
return_statement: return first_coll, rec_infos
docstring: Process WARC archive.
  
          :param User user: user
          :param str force_coll_name: name of collection to upload into
          :param list infos: list of recordings (indices)
          :param stream: file object
          :param str filename: WARC archive filename
          :param int total_size: WARC archive size
          :param int num_recs: number of recordings
  
          :returns: collection and recordings
          :rtype: Collection and list
docstring_summary: Process WARC archive.
docstring_tokens: Process WARC archive .
function: def process_upload(self, user, force_coll_name, infos, stream, filename, total_size, num_recs):
          """Process WARC archive.
  
          :param User user: user
          :param str force_coll_name: name of collection to upload into
          :param list infos: list of recordings (indices)
          :param stream: file object
          :param str filename: WARC archive filename
          :param int total_size: WARC archive size
          :param int num_recs: number of recordings
  
          :returns: collection and recordings
          :rtype: Collection and list
          """
          stream.seek(0)
  
          count = 0
  
          first_coll = None
  
          collection = None
          recording = None
  
          if force_coll_name:
              collection = user.get_collection_by_name(force_coll_name)
  
          rec_infos = []
  
          lists = None
  
          for info in infos:
              type = info.get('type')
  
              if type == 'collection':
                  if not collection:
                      collection = self.make_collection(user, filename, info)
                  lists = info.get('lists')
  
  
              elif type == 'recording':
                  if not collection:
                      collection = self.make_collection(user, filename, self.upload_coll_info, info)
  
                  desc = info.get('desc', '')
  
                  # if title was auto-generated for compatibility on export,
                  # set title to blank
                  if info.get('auto_title'):
                      title = ''
                  else:
                      title = info.get('title', '')
  
                  recording = collection.create_recording(title=title,
                                                          desc=desc,
                                                          rec_type=info.get('rec_type'),
                                                          ra_list=info.get('ra'))
  
                  info['id'] = recording.my_id
  
                  count += 1
                  #yield collection, recording
  
                  logger.debug('Processing Upload Rec {0} of {1}'.format(count, num_recs))
  
                  rec_infos.append({'coll': collection.my_id,
                                    'rec': recording.my_id,
                                    'offset': info['offset'],
                                    'length': info['length'],
                                    'pages': info.get('pages', None),
                                    'collection': collection,
                                    'recording': recording,
                                    'created_at': info.get('created_at'),
                                    'updated_at': info.get('updated_at'),
                                    'recorded_at': info.get('recorded_at', info.get('updated_at')),
                                   })
  
              if not first_coll:
                  first_coll = collection
  
  
          if lists:
              collection.data['_lists'] = lists
  
          return first_coll, rec_infos
function_tokens: def process_upload ( self , user , force_coll_name , infos , stream , filename , total_size , num_recs ) : stream . seek ( 0 ) count = 0 first_coll = None collection = None recording = None if force_coll_name : collection = user . get_collection_by_name ( force_coll_name ) rec_infos = [ ] lists = None for info in infos : type = info . get ( 'type' ) if type == 'collection' : if not collection : collection = self . make_collection ( user , filename , info ) lists = info . get ( 'lists' ) elif type == 'recording' : if not collection : collection = self . make_collection ( user , filename , self . upload_coll_info , info ) desc = info . get ( 'desc' , '' ) # if title was auto-generated for compatibility on export, # set title to blank if info . get ( 'auto_title' ) : title = '' else : title = info . get ( 'title' , '' ) recording = collection . create_recording ( title = title , desc = desc , rec_type = info . get ( 'rec_type' ) , ra_list = info . get ( 'ra' ) ) info [ 'id' ] = recording . my_id count += 1 #yield collection, recording logger . debug ( 'Processing Upload Rec {0} of {1}' . format ( count , num_recs ) ) rec_infos . append ( { 'coll' : collection . my_id , 'rec' : recording . my_id , 'offset' : info [ 'offset' ] , 'length' : info [ 'length' ] , 'pages' : info . get ( 'pages' , None ) , 'collection' : collection , 'recording' : recording , 'created_at' : info . get ( 'created_at' ) , 'updated_at' : info . get ( 'updated_at' ) , 'recorded_at' : info . get ( 'recorded_at' , info . get ( 'updated_at' ) ) , } ) if not first_coll : first_coll = collection if lists : collection . data [ '_lists' ] = lists return first_coll , rec_infos