                                total=self.alignments.frames_count):
              frame, alignments, count, key = alignment
              if count <= 1:
                  continue
              sorted_alignments = sorted([item for item in alignments],
                                         key=lambda x: (x[self.axis]))
              if sorted_alignments == alignments:
                  continue
              map_faces = self.map_face_names(alignments,
                                              sorted_alignments,
                                              frame)
 
</s> remove                               desc="Sort alignment indexes",
                              total=self.alignments.frames_count):
 </s> add                               desc="Sort alignment indexes", total=self.alignments.frames_count): </s> remove             map_faces = self.map_face_names(alignments,
                                            sorted_alignments,
                                            frame)
            self.rename_faces(map_faces)
 </s> add             logger.trace("Sorting alignments for frame: '%s'", frame) </s> remove 
    def map_face_names(self, alignments, sorted_alignments, frame):
        """ Map the old and new indexes for face renaming """
        map_faces = list()
        if not self.faces:
            return map_faces
        for idx, alignment in enumerate(alignments):
            idx_new = sorted_alignments.index(alignment)
            mapping = [{"old_name": face["face_fullname"],
                        "new_name": "{}_{}{}".format(frame,
                                                     idx_new,
                                                     face["face_extension"])}
                       for face in self.faces.file_list_sorted
                       if face["frame_name"] == frame
                       and face["face_index"] == idx]
            if not mapping:
                logger.warning("No face image found for frame '%s' at index %s", frame, idx)
            map_faces.extend(mapping)
        return map_faces

    def rename_faces(self, map_faces):
        """ Rename faces
            Done in 2 iterations as two files cannot share the same name """
        temp_ext = ".temp_move"
        for action in ("temp", "final"):
            for face in map_faces:
                old = face["old_name"]
                new = face["new_name"]
                if old == new:
                    continue
                old_file = old if action == "temp" else old + temp_ext
                new_file = old + temp_ext if action == "temp" else new
                src = os.path.join(self.faces.folder, old_file)
                dst = os.path.join(self.faces.folder, new_file)
                os.rename(src, dst)
                if action == "final":
                    logger.verbose("Renamed '%s' to '%s'", old, new)
 </s> add         return reindexed
            sorted_alignments = sorted([item for item in alignments], key=lambda x: (x[self.axis]))
                                total=self.alignments.frames_count):
              frame, alignments, count, key = alignment
              if count <= 1:
                  continue
            sorted_alignments = sorted([item for item in alignments], key=lambda x: (x[self.axis]))
            sorted_alignments = sorted([item for item in alignments], key=lambda x: (x[self.axis]))
              if sorted_alignments == alignments:
                  continue
              map_faces = self.map_face_names(alignments,
                                              sorted_alignments,
                                              frame)
keep keep keep keep replace replace keep keep keep keep keep
 Add Face Hashes to Alignments (#550)

* Convert main scripts to use face hashes

* Alignment tool: Use hashes, add logging, add face rename function

* More logging. Update Manual tool to work with hashing 
tools/lib_alignments/jobs.py