diff --git a/syncplay/constants.py b/syncplay/constants.py index 3cab3d1..b8774ea 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -133,7 +133,7 @@ USERLIST_GUI_USERNAME_OFFSET = 21 # Pixels MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4', '-af', 'scaletempo'] # --quiet works with both mpv 0.2 and 0.3 -MPV_SLAVE_ARGS = ['--hr-seek=always', '--quiet', '--keep-open', '-af', 'scaletempo'] +MPV_SLAVE_ARGS = ['--force-window','--idle','--hr-seek=always', '--quiet', '--keep-open', '-af', 'scaletempo'] MPV_SLAVE_ARGS_WINDOWS = ['--slave-broken'] MPV_SLAVE_ARGS_NONWINDOWS = ['--input-terminal=no','--input-file=/dev/stdin'] MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=length}\nANS_path=${path}\n'] diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index 1a7bc96..54007b1 100644 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -255,14 +255,16 @@ class MplayerPlayer(BasePlayer): class __Listener(threading.Thread): def __init__(self, playerController, playerPath, filePath, args): self.__playerController = playerController - if not filePath: + if self.__playerController.getPlayerPathErrors(playerPath,filePath): raise ValueError() - if '://' not in filePath: + if filePath and '://' not in filePath: if not os.path.isfile(filePath) and 'PWD' in os.environ: filePath = os.environ['PWD'] + os.path.sep + filePath filePath = os.path.realpath(filePath) - call = [playerPath, filePath] + call = [playerPath] + if filePath: + call.extend(filePath) call.extend(playerController.getStartupArgs(playerPath)) if args: call.extend(args) @@ -273,11 +275,16 @@ class MplayerPlayer(BasePlayer): env = os.environ.copy() if 'TERM' in env: del env['TERM'] - self.__process = subprocess.Popen(call, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.__getCwd(filePath, env), env=env) + if filePath: + self.__process = subprocess.Popen(call, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.__getCwd(filePath, env), env=env) + else: + self.__process = subprocess.Popen(call, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) threading.Thread.__init__(self, name="MPlayer Listener") def __getCwd(self, filePath, env): + if not filePath: + return None if os.path.isfile(filePath): cwd = os.path.dirname(filePath) elif 'HOME' in env: diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 3a64936..7424666 100644 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -67,6 +67,10 @@ class MpvPlayer(MplayerPlayer): def getIconPath(path): return constants.MPV_ICONPATH + @staticmethod + def getPlayerPathErrors(playerPath, filePath): + return None + class OldMpvPlayer(MpvPlayer): POSITION_QUERY = 'time-pos' OSD_QUERY = 'show_text'