code: def scan_file(fullpath, relpath):
      
  
      load_metafile.cache_clear()
  
      meta = load_metafile(fullpath)
      if not meta:
          return True
  
      # update the category meta file mapping
      category = meta.get('Category', utils.get_category(relpath))
      values = {
          'category': category,
          'file_path': fullpath,
          'sort_name': meta.get('Sort-Name', '')
      }
  
      logger.debug("setting category %s to metafile %s", category, fullpath)
      record = model.Category.get(category=category)
      if record:
          record.set(**values)
      else:
          record = model.Category(**values)
  
      # update other relationships to the index
      path_alias.remove_aliases(record)
      for alias in meta.get_all('Path-Alias', []):
          path_alias.set_alias(alias, category=record)
  
      orm.commit()
  
      return record
docs: scan a file and put it into the index