jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
554 stars 69 forks source link

Please add observe_property function #3

Closed Frechdachs closed 8 years ago

Frechdachs commented 8 years ago

It would be great if this interface would implement the observe_property function. Or is there already something that provides similar functionality?

jaseg commented 8 years ago

done. Use it like this:

player = mpv.MPV()

def handler(property_change_event):
    print(property_change_event['name'], property_change_event['value'])

player.observe_property('paused', handler)
jaseg commented 8 years ago

One note of caution: The player signals the property change via an event. This means the handler is called in a blocking fashion from the event handling thread spawned internally.

Frechdachs commented 8 years ago

Thank you!