From 119d447e7cc6faf48464eebed50d2ce8c4871dc5 Mon Sep 17 00:00:00 2001 From: Alberto Sottile Date: Mon, 26 Oct 2020 20:01:31 +0100 Subject: [PATCH] Pass again environment to the subprocess.Popen call that opens mpv Related to: c07206c18992c1dca401b30a01b9f0fe54a71df5 --- syncplay/players/ipc_iina.py | 4 ++-- syncplay/players/mpv.py | 2 +- syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/syncplay/players/ipc_iina.py b/syncplay/players/ipc_iina.py index 55a9f85..a91e8ff 100755 --- a/syncplay/players/ipc_iina.py +++ b/syncplay/players/ipc_iina.py @@ -25,8 +25,8 @@ class IINAProcess(MPVProcess): Manages an IINA process, ensuring the socket or pipe is available. (Internal) """ - def _start_process(self, ipc_socket, args): - self.process = subprocess.Popen(args) + def _start_process(self, ipc_socket, args, env): + self.process = subprocess.Popen(args, env=env) ipc_exists = False for _ in range(100): # Give IINA 10 seconds to start. time.sleep(0.1) diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 20820c2..cebc63d 100755 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -603,7 +603,7 @@ class MpvPlayer(BasePlayer): env['PYTHONPATH'] = pythonPath try: 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: 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) diff --git a/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py b/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py index ddfe83b..64b3dc2 100644 --- a/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py +++ b/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py @@ -182,7 +182,7 @@ class MPVProcess: """ 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. @@ -208,9 +208,9 @@ class MPVProcess: self.ipc_socket = ipc_socket 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) ipc_exists = False for _ in range(100): # Give MPV 10 seconds to start.