'Renames all the torrent files to INFOHASH.torrent and delete unparseable ones.'

def _rename_torrent_files(self):

    def update_status():
        progress = 1.0
        if (self.total_torrent_file_count > 0):
            progress = (float(self.total_torrent_files_processed) / self.total_torrent_file_count)
        progress *= 100
        self.status_update_func((u'Migrating    torrent    files    %.2f%%...' % progress))
    for (root, _, files) in os.walk(self.torrent_collecting_dir):
        for name in files:
            file_path = os.path.join(root, name)
            try:
                tdef = TorrentDef.load(file_path)
                move(file_path, os.path.join(self.tmp_migration_dir, (hexlify(tdef.infohash) + u'.torrent')))
                self.torrent_files_migrated += 1
            except Exception as e:
                self._logger.error(u'dropping    corrupted    torrent    file    %s:    %s', file_path, str(e))
                os.unlink(file_path)
                self.torrent_files_dropped += 1
            self.total_torrent_files_processed += 1
            update_status()
        break
