summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrechdachs <frechdachs@rekt.cc>2017-01-06 13:52:50 +0100
committerFrechdachs <frechdachs@rekt.cc>2017-01-06 13:52:50 +0100
commit9cc3a25c73bfce119cafadeff8caa5b45b799981 (patch)
treef333a5d58013192f18ca7c32d77f02dcfa1c71aa
parent9fa18058ad780c9d38a415781540f14e30a4efb5 (diff)
downloadpython-mpv-9cc3a25c73bfce119cafadeff8caa5b45b799981.tar.gz
python-mpv-9cc3a25c73bfce119cafadeff8caa5b45b799981.tar.bz2
python-mpv-9cc3a25c73bfce119cafadeff8caa5b45b799981.zip
Make sure _mpv_initialize is called before _mpv_terminate_destroy
-rw-r--r--mpv.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mpv.py b/mpv.py
index acf7913..c8ea147 100644
--- a/mpv.py
+++ b/mpv.py
@@ -413,10 +413,14 @@ class MPV(object):
_mpv_set_option_string(self.handle, b'audio-display', b'no')
istr = lambda o: ('yes' if o else 'no') if type(o) is bool else str(o)
- for flag in extra_mpv_flags:
- _mpv_set_option_string(self.handle, flag.encode('utf-8'), b'')
- for k,v in extra_mpv_opts.items():
- _mpv_set_option_string(self.handle, k.replace('_', '-').encode('utf-8'), istr(v).encode('utf-8'))
+ try:
+ for flag in extra_mpv_flags:
+ _mpv_set_option_string(self.handle, flag.encode('utf-8'), b'')
+ for k,v in extra_mpv_opts.items():
+ _mpv_set_option_string(self.handle, k.replace('_', '-').encode('utf-8'), istr(v).encode('utf-8'))
+ except AttributeError as e:
+ _mpv_initialize(self.handle)
+ raise e
_mpv_initialize(self.handle)
self._event_callbacks = []