Fixes VLC close issue on macOS (#83)
This commit is contained in:
parent
846d7f7536
commit
32882ee7ee
@ -172,6 +172,7 @@ MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${f
|
|||||||
MPV_NEW_VERSION = False
|
MPV_NEW_VERSION = False
|
||||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
||||||
'--play-and-pause', '--start-time=0']
|
'--play-and-pause', '--start-time=0']
|
||||||
|
VLC_SLAVE_OSX_ARGS = ['--verbose=2', '--no-file-logging']
|
||||||
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
|
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
|
||||||
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["no-osd set time-pos ", "loadfile "]
|
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["no-osd set time-pos ", "loadfile "]
|
||||||
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
||||||
|
|||||||
@ -20,8 +20,10 @@ class VlcPlayer(BasePlayer):
|
|||||||
|
|
||||||
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
|
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
|
||||||
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
|
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
|
||||||
if not sys.platform.startswith('darwin'):
|
if sys.platform.startswith('darwin'):
|
||||||
SLAVE_ARGS.extend(constants.VLC_SLAVE_NONOSX_ARGS)
|
SLAVE_ARGS.extend(constants.VLC_SLAVE_OSX_ARGS)
|
||||||
|
else:
|
||||||
|
SLAVE_ARGS.extend(constants.VLC_SLAVE_NONOSX_ARGS)
|
||||||
vlcport = random.randrange(constants.VLC_MIN_PORT, constants.VLC_MAX_PORT) if (constants.VLC_MIN_PORT < constants.VLC_MAX_PORT) else constants.VLC_MIN_PORT
|
vlcport = random.randrange(constants.VLC_MIN_PORT, constants.VLC_MAX_PORT) if (constants.VLC_MIN_PORT < constants.VLC_MAX_PORT) else constants.VLC_MIN_PORT
|
||||||
|
|
||||||
def __init__(self, client, playerPath, filePath, args):
|
def __init__(self, client, playerPath, filePath, args):
|
||||||
@ -381,7 +383,12 @@ class VlcPlayer(BasePlayer):
|
|||||||
playerController._client.ui.showErrorMessage(
|
playerController._client.ui.showErrorMessage(
|
||||||
getMessage("media-player-error").format(line), True)
|
getMessage("media-player-error").format(line), True)
|
||||||
break
|
break
|
||||||
self.__process.stderr = None
|
if not sys.platform.startswith('darwin'):
|
||||||
|
self.__process.stderr = None
|
||||||
|
else:
|
||||||
|
vlcoutputthread = threading.Thread(target = self.handle_vlcoutput, args=())
|
||||||
|
vlcoutputthread.setDaemon(True)
|
||||||
|
vlcoutputthread.start()
|
||||||
threading.Thread.__init__(self, name="VLC Listener")
|
threading.Thread.__init__(self, name="VLC Listener")
|
||||||
asynchat.async_chat.__init__(self)
|
asynchat.async_chat.__init__(self)
|
||||||
self.set_terminator("\n")
|
self.set_terminator("\n")
|
||||||
@ -427,6 +434,15 @@ class VlcPlayer(BasePlayer):
|
|||||||
asynchat.async_chat.handle_close(self)
|
asynchat.async_chat.handle_close(self)
|
||||||
self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION))
|
self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION))
|
||||||
|
|
||||||
|
def handle_vlcoutput(self):
|
||||||
|
out = self.__process.stderr
|
||||||
|
for line in iter(out.readline, ''):
|
||||||
|
if '[syncplay] core interface debug: removing module' in line:
|
||||||
|
self.__playerController.drop()
|
||||||
|
break
|
||||||
|
out.close()
|
||||||
|
|
||||||
|
|
||||||
def found_terminator(self):
|
def found_terminator(self):
|
||||||
self.vlcHasResponded = True
|
self.vlcHasResponded = True
|
||||||
self.__playerController.lineReceived("".join(self._ibuffer))
|
self.__playerController.lineReceived("".join(self._ibuffer))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user