feat(main.py): add seek modifiers for A/D keys with Shift and Ctrl
This commit is contained in:
32
main.py
32
main.py
@@ -31,6 +31,10 @@ class MediaGrader:
|
||||
TIMELINE_COLOR_HANDLE = (255, 255, 255)
|
||||
TIMELINE_COLOR_BORDER = (200, 200, 200)
|
||||
|
||||
# Seek modifiers for A/D keys
|
||||
SHIFT_SEEK_MULTIPLIER = 5 # SHIFT + A/D multiplier
|
||||
CTRL_SEEK_MULTIPLIER = 10 # CTRL + A/D multiplier
|
||||
|
||||
def __init__(
|
||||
self, directory: str, seek_frames: int = 30, snap_to_iframe: bool = False
|
||||
):
|
||||
@@ -602,11 +606,25 @@ class MediaGrader:
|
||||
|
||||
seek_direction = 0
|
||||
seek_amount = 0
|
||||
seek_multiplier = 1 # Default multiplier
|
||||
|
||||
if key == ord("a"):
|
||||
# Check for A/D keys with modifiers
|
||||
if key == ord("a") or key == ord("A"):
|
||||
seek_direction = -1
|
||||
elif key == ord("d"):
|
||||
# SHIFT+A gives uppercase A
|
||||
if key == ord("A"):
|
||||
seek_multiplier = self.SHIFT_SEEK_MULTIPLIER
|
||||
elif key == ord("d") or key == ord("D"):
|
||||
seek_direction = 1
|
||||
# SHIFT+D gives uppercase D
|
||||
if key == ord("D"):
|
||||
seek_multiplier = self.SHIFT_SEEK_MULTIPLIER
|
||||
elif key == 1: # CTRL+A
|
||||
seek_direction = -1
|
||||
seek_multiplier = self.CTRL_SEEK_MULTIPLIER
|
||||
elif key == 4: # CTRL+D
|
||||
seek_direction = 1
|
||||
seek_multiplier = self.CTRL_SEEK_MULTIPLIER
|
||||
elif key == ord(","):
|
||||
seek_amount = -self.fine_seek_frames
|
||||
elif key == ord("."):
|
||||
@@ -622,7 +640,7 @@ class MediaGrader:
|
||||
self.seek_video(seek_amount)
|
||||
return True
|
||||
|
||||
# Handle arrow key seeking with rate limiting
|
||||
# Handle A/D key seeking with rate limiting and modifiers
|
||||
if seek_direction != 0:
|
||||
if self.current_seek_key != key:
|
||||
self.current_seek_key = key
|
||||
@@ -630,7 +648,7 @@ class MediaGrader:
|
||||
self.last_seek_time = current_time
|
||||
self.is_seeking = True
|
||||
|
||||
seek_amount = seek_direction * self.coarse_seek_frames
|
||||
seek_amount = seek_direction * self.coarse_seek_frames * seek_multiplier
|
||||
self.seek_video(seek_amount)
|
||||
return True
|
||||
|
||||
@@ -642,9 +660,9 @@ class MediaGrader:
|
||||
self.last_seek_time = current_time
|
||||
|
||||
if time_held > self.FAST_SEEK_ACTIVATION_TIME:
|
||||
seek_amount = seek_direction * self.fast_seek_frames
|
||||
seek_amount = seek_direction * self.fast_seek_frames * seek_multiplier
|
||||
else:
|
||||
seek_amount = seek_direction * self.coarse_seek_frames
|
||||
seek_amount = seek_direction * self.coarse_seek_frames * seek_multiplier
|
||||
|
||||
self.seek_video(seek_amount)
|
||||
return True
|
||||
@@ -751,6 +769,8 @@ class MediaGrader:
|
||||
print("Controls:")
|
||||
print(" Space: Pause/Play")
|
||||
print(" A/D: Seek backward/forward (hold for FAST seek)")
|
||||
print(" Shift+A/D: Seek backward/forward (5x multiplier)")
|
||||
print(" Ctrl+A/D: Seek backward/forward (10x multiplier)")
|
||||
print(" , / . : Frame-by-frame seek (fine control)")
|
||||
print(" W/S: Decrease/Increase playback speed")
|
||||
print(" 1-5: Grade and move file")
|
||||
|
Reference in New Issue
Block a user