diff options
author | jaseg <code@jaseg.net> | 2020-07-16 19:28:33 +0200 |
---|---|---|
committer | jaseg <code@jaseg.net> | 2020-07-16 19:28:33 +0200 |
commit | 759b9701c379997cc37d1c128a83302863e7df4f (patch) | |
tree | c53653e4ca1e36c54ac62607cce19dfc429ec733 /mpv.py | |
parent | 7362f663c16f81d051757c2f79b764b0eb8d2a90 (diff) | |
download | python-mpv-759b9701c379997cc37d1c128a83302863e7df4f.tar.gz python-mpv-759b9701c379997cc37d1c128a83302863e7df4f.tar.bz2 python-mpv-759b9701c379997cc37d1c128a83302863e7df4f.zip |
mpv.py: add wait_until_paused, wait_until_playing
Diffstat (limited to 'mpv.py')
-rw-r--r-- | mpv.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -886,6 +886,14 @@ class MPV(object): with self._playback_cond: self._playback_cond.wait() + def wait_until_paused(self): + """Waits until playback of the current title is paused or done.""" + self.wait_for_property('core-idle') + + def wait_until_playing(self): + """Waits until playback of the current title has started.""" + self.wait_for_property('core-idle', lambda idle: not idle) + def wait_for_property(self, name, cond=lambda val: val, level_sensitive=True): """Waits until ``cond`` evaluates to a truthy value on the named property. This can be used to wait for properties such as ``idle_active`` indicating the player is done with regular playback and just idling around |