Merge pull request #400 from Syncplay/update-mpv-jsonipc-vendor-code-2
Update mpv json ipc vendor code
This commit is contained in:
commit
77ce05d02d
@ -112,6 +112,10 @@ class WindowsSocket(threading.Thread):
|
||||
except EOFError:
|
||||
if self.quit_callback:
|
||||
self.quit_callback()
|
||||
except Exception as ex:
|
||||
log.error("Pipe connection died.", exc_info=1)
|
||||
if self.quit_callback:
|
||||
self.quit_callback()
|
||||
|
||||
class UnixSocket(threading.Thread):
|
||||
"""
|
||||
@ -159,22 +163,25 @@ class UnixSocket(threading.Thread):
|
||||
def run(self):
|
||||
"""Process socket events. Do not run this directly. Use *start*."""
|
||||
data = b''
|
||||
while True:
|
||||
current_data = self.socket.recv(1024)
|
||||
if current_data == b'':
|
||||
break
|
||||
try:
|
||||
while True:
|
||||
current_data = self.socket.recv(1024)
|
||||
if current_data == b'':
|
||||
break
|
||||
|
||||
data += current_data
|
||||
if data[-1] != 10:
|
||||
continue
|
||||
|
||||
data = data.decode('utf-8', 'ignore').encode('utf-8')
|
||||
for item in data.split(b'\n'):
|
||||
if item == b'':
|
||||
data += current_data
|
||||
if data[-1] != 10:
|
||||
continue
|
||||
json_data = json.loads(item)
|
||||
self.callback(json_data)
|
||||
data = b''
|
||||
|
||||
data = data.decode('utf-8', 'ignore').encode('utf-8')
|
||||
for item in data.split(b'\n'):
|
||||
if item == b'':
|
||||
continue
|
||||
json_data = json.loads(item)
|
||||
self.callback(json_data)
|
||||
data = b''
|
||||
except Exception as ex:
|
||||
log.error("Socket connection died.", exc_info=1)
|
||||
if self.quit_callback:
|
||||
self.quit_callback()
|
||||
|
||||
|
||||
2
syncplay/vendor/python_mpv_jsonipc/setup.py
vendored
2
syncplay/vendor/python_mpv_jsonipc/setup.py
vendored
@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
|
||||
|
||||
setup(
|
||||
name='python-mpv-jsonipc',
|
||||
version='1.1.11',
|
||||
version='1.1.13',
|
||||
author="Ian Walton",
|
||||
author_email="iwalton3@gmail.com",
|
||||
description="Python API to MPV using JSON IPC",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user