Pass again environment to the subprocess.Popen call that opens mpv

Related to: c07206c18992c1dca401b30a01b9f0fe54a71df5
This commit is contained in:
Alberto Sottile 2020-10-26 20:01:31 +01:00
parent 03f5eaf31d
commit 119d447e7c
3 changed files with 6 additions and 6 deletions

View File

@ -25,8 +25,8 @@ class IINAProcess(MPVProcess):
Manages an IINA process, ensuring the socket or pipe is available. (Internal) Manages an IINA process, ensuring the socket or pipe is available. (Internal)
""" """
def _start_process(self, ipc_socket, args): def _start_process(self, ipc_socket, args, env):
self.process = subprocess.Popen(args) self.process = subprocess.Popen(args, env=env)
ipc_exists = False ipc_exists = False
for _ in range(100): # Give IINA 10 seconds to start. for _ in range(100): # Give IINA 10 seconds to start.
time.sleep(0.1) time.sleep(0.1)

View File

@ -603,7 +603,7 @@ class MpvPlayer(BasePlayer):
env['PYTHONPATH'] = pythonPath env['PYTHONPATH'] = pythonPath
try: try:
socket = self.mpv_arguments.get('input-ipc-server') socket = self.mpv_arguments.get('input-ipc-server')
self.mpvpipe = self.playerIPCHandler(mpv_location=self.playerPath, ipc_socket=socket, loglevel="info", log_handler=self.__playerController.mpv_log_handler, quit_callback=self.stop_client, **self.mpv_arguments) self.mpvpipe = self.playerIPCHandler(mpv_location=self.playerPath, ipc_socket=socket, loglevel="info", log_handler=self.__playerController.mpv_log_handler, quit_callback=self.stop_client, env=env, **self.mpv_arguments)
except Exception as e: except Exception as e:
self.quitReason = getMessage("media-player-error").format(str(e)) + " " + getMessage("mpv-failed-advice") self.quitReason = getMessage("media-player-error").format(str(e)) + " " + getMessage("mpv-failed-advice")
self.__playerController.reactor.callFromThread(self.__playerController._client.ui.showErrorMessage, self.quitReason, True) self.__playerController.reactor.callFromThread(self.__playerController._client.ui.showErrorMessage, self.quitReason, True)

View File

@ -182,7 +182,7 @@ class MPVProcess:
""" """
Manages an MPV process, ensuring the socket or pipe is available. (Internal) Manages an MPV process, ensuring the socket or pipe is available. (Internal)
""" """
def __init__(self, ipc_socket, mpv_location=None, **kwargs): def __init__(self, ipc_socket, mpv_location=None, env=None, **kwargs):
""" """
Create and start the MPV process. Will block until socket/pipe is available. Create and start the MPV process. Will block until socket/pipe is available.
@ -208,9 +208,9 @@ class MPVProcess:
self.ipc_socket = ipc_socket self.ipc_socket = ipc_socket
args = self._get_arglist(mpv_location, **kwargs) args = self._get_arglist(mpv_location, **kwargs)
self._start_process(ipc_socket, args) self._start_process(ipc_socket, args, env=env)
def _start_process(self, ipc_socket, args): def _start_process(self, ipc_socket, args, env):
self.process = subprocess.Popen(args) self.process = subprocess.Popen(args)
ipc_exists = False ipc_exists = False
for _ in range(100): # Give MPV 10 seconds to start. for _ in range(100): # Give MPV 10 seconds to start.