summaryrefslogtreecommitdiff
path: root/mpv.py
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2016-08-02 13:45:58 +0200
committerjaseg <code@jaseg.net>2016-08-02 13:45:58 +0200
commitae8770df30dbb1b9999777ba084aee14f6504e56 (patch)
tree316edb0d5e5a1f211d797426141340f73ed11510 /mpv.py
parent35de5ecc9378a6f1944b75a92597f9405e93061e (diff)
downloadpython-mpv-ae8770df30dbb1b9999777ba084aee14f6504e56.tar.gz
python-mpv-ae8770df30dbb1b9999777ba084aee14f6504e56.tar.bz2
python-mpv-ae8770df30dbb1b9999777ba084aee14f6504e56.zip
Make ynbool python2-compatible
Diffstat (limited to 'mpv.py')
-rw-r--r--mpv.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mpv.py b/mpv.py
index 865148c..fb1c35a 100644
--- a/mpv.py
+++ b/mpv.py
@@ -19,7 +19,7 @@ class MpvHandle(c_void_p):
pass
-class ErrorCode:
+class ErrorCode(object):
""" For documentation on these, see mpv's libmpv/client.h """
SUCCESS = 0
EVENT_QUEUE_FULL = -1
@@ -248,12 +248,14 @@ _handle_func('mpv_set_wakeup_callback', [WakeupCallback, c_void_p], c_int)
_handle_func('mpv_get_wakeup_pipe', [], c_int)
-class ynbool:
+class ynbool(object):
def __init__(self, val=False):
self.val = bool(val and val not in (b'no', 'no'))
-
+
def __bool__(self):
return bool(self.val)
+ # Python 2 only:
+ __nonzero__ = __bool__
def __str__(self):
return 'yes' if self.val else 'no'