                                         total=len(filelist),
                                         desc="Reading Face Data"):
  
              if "itxt" not in metadata or "source" not in metadata["itxt"]:
                  if self._alignments is None:  # Can't update legacy
                      raise FaceswapError(
                          f"The folder '{self.folder}' contains images that do not include Faceswap "
                          "metadata.\nAll images in the provided folder should contain faces "
                          "generated from Faceswap's extraction process.\nPlease double check the "
                          "source and try again.")
  
                  if not log_once:
                      logger.warning("Legacy faces discovered. These faces will be updated")
                      log_once = True
                  data = update_legacy_png_header(fullpath, self._alignments)
                  if not data:
                      raise FaceswapError(
                          f"Some of the faces being passed in from '{self.folder}' could not be "
                          f"matched to the alignments file '{self._alignments.file}'\nPlease double "
                          "check your sources and try again.")
                  sub_dict = data
              else:
                  sub_dict = cast("PNGHeaderDict", metadata["itxt"])
  
              if (self._alignments is not None and  # filter existing
                      not self._alignments.frame_exists(sub_dict["source"]["source_filename"])):
 
</s> remove         if is_legacy:  # Legacy updating
 </s> add         if self._alignments is not None and self._alignments.version < 2.1:  # Legacy updating </s> remove         is_legacy = self._alignments is not None and self._alignments.version < 2.1
 </s> add 
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                                         total=len(filelist),
                                         desc="Reading Face Data"):
  
              if "itxt" not in metadata or "source" not in metadata["itxt"]:
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
                sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True
              else:
                  sub_dict = cast("PNGHeaderDict", metadata["itxt"])
  
              if (self._alignments is not None and  # filter existing
                      not self._alignments.frame_exists(sub_dict["source"]["source_filename"])):
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 bugfix: Alignments tool - remove faces:
  - Handle duplicate face images 
tools/alignments/media.py