Add ability to seek media using left and right arrow keys

This commit is contained in:
mrkmntal 2026-10-27 12:39:12 -04:00
commit 0065141467

View file

@ -57,7 +57,7 @@ class MainView:
self.app.draw_messages()
def _draw_help(self):
text = " [Space]Pause [h/l]Seek [j/k]Vol [s]Sub [e]Plist [o]Queue [r/R]Loop [q]Quit"
text = " [Space]Pause [KLeft/KRight]Seek [j/k]Vol [s]Sub [e]Plist [o]Queue [r/R]Loop [q]Quit"
self.app.draw_help_bar(text)
def handle_key(self, key):
@ -68,10 +68,10 @@ class MainView:
is_paused = self.app.client.get_property("pause")
msg = ">> Video Paused..." if is_paused else ">> Video Unpaused..."
self.app.add_message(msg)
elif key == config.KEY_SEEK_BACK:
elif key in (config.KEY_SEEK_BACK, curses.KEY_LEFT):
self.app.client.command("seek", "-10")
self.app.add_message(">> Seeked -10s")
elif key == config.KEY_SEEK_FWD:
elif key in (config.KEY_SEEK_FWD, curses.KEY_RIGHT):
self.app.client.command("seek", "10")
self.app.add_message(">> Seeked +10s")
elif key == config.KEY_VOL_UP:
@ -113,7 +113,7 @@ class MainView:
self.app.add_message(">> Loop Current Playlist: no")
elif key == config.KEY_CONTROLS:
self.app.add_message("=== Controls ===")
self.app.add_message("[Space] Pause | [h/l] Seek -10s/+10s | [j/k] Vol -/+")
self.app.add_message("[Space] Pause | [KLeft/KRight] Seek -10s/+10s | [j/k] Vol -/+")
self.app.add_message("[s] Subtitle | [o] Queue | [e] Playlist | [n/p] Next/Prev")
self.app.add_message("[r/R] Loop File/Playlist (state shown in status bar) | [q] Quit")
elif key == config.KEY_PLAYLIST: