From c16c3a794a147c89ba2887670e5f626843d7beb2 Mon Sep 17 00:00:00 2001 From: pax Date: Fri, 17 Apr 2026 20:15:50 -0500 Subject: [PATCH] video_player: hoist time import to module top --- booru_viewer/gui/media/video_player.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/booru_viewer/gui/media/video_player.py b/booru_viewer/gui/media/video_player.py index cc7efa4..0087764 100644 --- a/booru_viewer/gui/media/video_player.py +++ b/booru_viewer/gui/media/video_player.py @@ -3,6 +3,7 @@ from __future__ import annotations import logging +import time from PySide6.QtCore import Qt, QTimer, Signal, Property, QPoint from PySide6.QtGui import QColor, QIcon, QPixmap, QPainter, QPen, QPolygon, QPainterPath, QFont @@ -456,8 +457,7 @@ class VideoPlayer(QWidget): # treated as belonging to the previous file's stop and # ignored — see the long comment at __init__'s # `_eof_ignore_until` definition for the race trace. - import time as _time - self._eof_ignore_until = _time.monotonic() + self._eof_ignore_window_secs + self._eof_ignore_until = time.monotonic() + self._eof_ignore_window_secs self._last_video_size = None # reset dedupe so new file fires a fit self._apply_loop_to_mpv() @@ -617,8 +617,7 @@ class VideoPlayer(QWidget): reset and trigger a spurious play_next auto-advance. """ if value is True: - import time as _time - if _time.monotonic() < self._eof_ignore_until: + if time.monotonic() < self._eof_ignore_until: # Stale eof from a previous file's stop. Drop it. return self._eof_pending = True