fix(main.py): conditionally display info overlay and timeline for video files only

This commit is contained in:
2025-08-19 08:11:19 +02:00
parent adc468bbc2
commit 47b190bbf0

View File

@@ -167,6 +167,7 @@ class MediaGrader:
# Add info overlay
current_file = self.media_files[self.current_index]
if self.is_video(self.media_files[self.current_index]):
info_text = f"Speed: {self.playback_speed:.1f}x | Frame: {self.current_frame}/{self.total_frames} | File: {self.current_index + 1}/{len(self.media_files)} | {'Playing' if self.is_playing else 'PAUSED'}"
cv2.putText(
@@ -189,6 +190,10 @@ class MediaGrader:
def draw_timeline(self, frame):
"""Draw timeline at the bottom of the frame"""
# Only draw timeline for video files
if not self.is_video(self.media_files[self.current_index]):
return
height, width = frame.shape[:2]
self.window_height = height
self.window_width = width
@@ -210,7 +215,7 @@ class MediaGrader:
cv2.rectangle(frame, (bar_x_start, bar_y), (bar_x_end, bar_y + self.TIMELINE_BAR_HEIGHT), self.TIMELINE_COLOR_BORDER, 1)
# Draw progress for videos
if self.is_video(self.media_files[self.current_index]) and self.total_frames > 0:
if self.total_frames > 0:
progress = self.current_frame / max(1, self.total_frames - 1)
progress_width = int(bar_width * progress)
if progress_width > 0: