scrub optimization

This commit is contained in:
2026-04-03 06:40:08 -03:00
parent 9dfa252727
commit 84dc1405dc
13 changed files with 813 additions and 68 deletions

View File

@@ -92,9 +92,11 @@ class Player:
log.info("mpv load: %s", path)
self._player.loadfile(str(path), mode="replace")
def load_at(self, path, seconds, pause=True):
def load_at(self, path, seconds, pause=True, hr_seek=False):
"""Load a file and seek to position atomically. Avoids async seek race."""
log.info("mpv load_at: %s at %.1fs pause=%s", path, seconds, pause)
log.info("mpv load_at: %s at %.1fs pause=%s hr_seek=%s", path, seconds, pause, hr_seek)
if hr_seek:
self._player["hr-seek"] = "yes"
self._player["pause"] = pause
self._player.loadfile(str(path), mode="replace", start=str(seconds))