summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2017-05-21 13:39:08 +0200
committerjaseg <git@jaseg.net>2017-05-21 13:39:08 +0200
commitf841f343cf6fea5f8b6bd1bddbef5e7452a73e66 (patch)
tree3bcc1fc65216b65b5305c38ed8a894c284ac4d1f
parent76027e6fa6b42b71ca4fd008ae8dc971646305b8 (diff)
downloadpython-mpv-f841f343cf6fea5f8b6bd1bddbef5e7452a73e66.tar.gz
python-mpv-f841f343cf6fea5f8b6bd1bddbef5e7452a73e66.tar.bz2
python-mpv-f841f343cf6fea5f8b6bd1bddbef5e7452a73e66.zip
README: Fix property observer example
-rw-r--r--README.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 7016bd7..71a1a1f 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,5 @@
+.. vim: tw=120 sw=4 et
+
python-mpv
==========
@@ -52,7 +54,12 @@ Advanced Usage
player = mpv.MPV(log_handler=my_log, ytdl=True, input_default_bindings=True, input_vo_keyboard=True)
# Property access, these can be changed at runtime
- player.observe_property('time-pos', lambda pos: print('Now playing at {:.2f}s'.format(pos)))
+ @player.property_observer('time-pos')
+ def time_observer(_name, value):
+ # Here, _value is either None if nothing is playing or a float containing
+ # fractional seconds since the beginning of the file.
+ print('Now playing at {:.2f}s'.format(value)))
+
player.fullscreen = True
player.loop = 'inf'
# Option access, in general these require the core to reinitialize