From: Christian Heller Date: Mon, 16 Dec 2024 14:33:36 +0000 (+0100) Subject: In /playlist, don't block moving up/down towards playing entry, rather jump over it. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/processes?a=commitdiff_plain;h=4b9aad0f47edd6ed367def59bdbd48275cb7a47b;p=ytplom In /playlist, don't block moving up/down towards playing entry, rather jump over it. --- diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index 4f30cf5..3a0be6d 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -669,16 +669,15 @@ class Player: def move_entry(self, start_idx: int, upwards: bool = True) -> None: """Move playlist entry at start_idx up or down one step.""" - if (start_idx == self._idx - or (upwards and start_idx == self._idx + 1) - or ((not upwards) and start_idx == self._idx - 1) - or (upwards and start_idx < 1) - or ((not upwards) and start_idx > len(self.playlist) - 2)): - return i0, i1 = start_idx, start_idx + (-1 if upwards else 1) + if i1 < 0 or i1 >= len(self.playlist): + return if self._mpv: # NB: a functional playlist-move would do this in a single step, # but for some reason I don't seem to get it to do anything + if self._idx == i1: # currently playing entries to be jumped over + self._idx = i0 + i0, i1 = i1, i0 path = self.playlist[i1].full_path self._mpv.command('playlist-remove', i1) self._mpv.command('loadfile', path, 'insert-at', i0)