def cmd_swap(self, conn, i, j):
        i = cast_arg(int, i)
        j = cast_arg(int, j)
        try:
            track_i = self.playlist[i]
            track_j = self.playlist[j]
        except IndexError:
            raise ArgumentIndexError()

        self.playlist[j] = track_i
        self.playlist[i] = track_j

        # Update currently-playing song.
        if self.current_index == i:
            self.current_index = j
        elif self.current_index == j:
            self.current_index = i

        self.playlist_version += 1
Swaps two tracks in the playlist.
dataset/ETHPy150Open beetbox/beets/beetsplug/bpd/__init__.py/BaseServer.cmd_swap