From 4b9aad0f47edd6ed367def59bdbd48275cb7a47b Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 16 Dec 2024 15:33:36 +0100
Subject: [PATCH] In /playlist, don't block moving up/down towards playing
 entry, rather jump over it.

---
 src/ytplom/misc.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

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)
-- 
2.30.2