From 0b8afd72eceb86a9aaf862f3e553cbd1e16f1080 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Thu, 11 Jun 2015 22:03:45 +0100 Subject: [PATCH 1/2] [mpv] Use profile=pseudo-gui if available Makes mpv act as if it wasn't started through Syncplay. --profile=pseudo-gui was added in 0.9.0. --- syncplay/constants.py | 5 +++-- syncplay/players/mpv.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 498848f..4df7a96 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -133,9 +133,10 @@ STYLE_NOTCONTROLLER_COLOR = 'grey' 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 = ['--force-window', '--idle', '--hr-seek=always', '--quiet', '--keep-open', '--af=scaletempo', '--input-terminal=no', '--input-file=/dev/stdin'] +MPV_SLAVE_ARGS = ['--hr-seek=always', '--quiet', '--af=scaletempo', '--input-terminal=no', '--input-file=/dev/stdin'] MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=length}\nANS_path=${path}\n', '--terminal=yes'] +MPV_SLAVE_GUI = ['--force-window', '--idle', '--keep-open'] +MPV_SLAVE_GUI_NEW = ['--profile=pseudo-gui'] MPV_NEW_VERSION = False VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek', '--play-and-pause', '--start-time=0'] diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 09abe2a..a31a2f5 100644 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -24,6 +24,16 @@ class MpvPlayer(MplayerPlayer): @staticmethod def getStartupArgs(path): args = constants.MPV_SLAVE_ARGS + + try: + pseudogui = subprocess.check_output([path, '--profile=help']) + except: + pseudogui = '' + if 'pseudo-gui' in pseudogui: + args.extend(constants.MPV_SLAVE_GUI_NEW) + else: + args.extend(constants.MPV_SLAVE_GUI) + if constants.MPV_NEW_VERSION: args.extend(constants.MPV_SLAVE_ARGS_NEW) return args From 51699f78fe40ec97be3f77eecf85aefd4a440efd Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Thu, 11 Jun 2015 20:02:24 +0100 Subject: [PATCH 2/2] [mpv] Use --keep-open=always Added in 0.8.0 "always" pauses on EOF instead of proceeding to the next file on the playlist. This can be removed when Syncplay properly supports playlists. --- syncplay/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 4df7a96..d00258d 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -136,7 +136,7 @@ MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', MPV_SLAVE_ARGS = ['--hr-seek=always', '--quiet', '--af=scaletempo', '--input-terminal=no', '--input-file=/dev/stdin'] MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=length}\nANS_path=${path}\n', '--terminal=yes'] MPV_SLAVE_GUI = ['--force-window', '--idle', '--keep-open'] -MPV_SLAVE_GUI_NEW = ['--profile=pseudo-gui'] +MPV_SLAVE_GUI_NEW = ['--profile=pseudo-gui', '--keep-open=always'] MPV_NEW_VERSION = False VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek', '--play-and-pause', '--start-time=0']