From 4c695fc0be837acb15cf618e0c6e32054d5c3268 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Tue, 1 Jul 2014 00:21:08 +0200 Subject: [PATCH] Fixed mplayer/mpv not closing properly --- syncplay/client.py | 2 +- syncplay/constants.py | 213 ++++++++++++++++++------------------ syncplay/players/mplayer.py | 38 ++++--- 3 files changed, 132 insertions(+), 121 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index e2851a6..aa5a043 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -384,7 +384,7 @@ class SyncplayClient(object): return self._running = True if self._playerClass: - self._playerClass.run(self, self._config['playerPath'], self._config['file'], self._config['playerArgs']) + reactor.callLater(0.1, self._playerClass.run, self, self._config['playerPath'], self._config['file'], self._config['playerArgs']) self._playerClass = None self.protocolFactory = SyncClientFactory(self) port = int(port) diff --git a/syncplay/constants.py b/syncplay/constants.py index a801891..d54f18d 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -1,105 +1,108 @@ -#You might want to change these -DEFAULT_PORT = 8999 -OSD_DURATION = 3 -OSD_WARNING_MESSAGE_DURATION = 15 -MPC_OSD_POSITION = 2 #Right corner, 1 for left -MPLAYER_OSD_LEVEL = 1 -UI_TIME_FORMAT = "[%X] " -CONFIG_NAMES = [".syncplay", "syncplay.ini"] #Syncplay searches first to last -DEFAULT_CONFIG_NAME_WINDOWS = "syncplay.ini" -DEFAULT_CONFIG_NAME_LINUX = ".syncplay" -RECENT_CLIENT_THRESHOLD = "1.2.8" #This and higher considered 'recent' clients (no warnings) -WARN_OLD_CLIENTS = True #Use MOTD to inform old clients to upgrade -SHOW_OSD = True # Sends Syncplay messages to media player OSD -SHOW_OSD_WARNINGS = True # Show warnings if playing different file, alone in room -SHOW_SLOWDOWN_OSD = True # Show notifications of slowing down / reverting on time difference -SHOW_SAME_ROOM_OSD = True # Show OSD notifications for events relating to room user is in -SHOW_DIFFERENT_ROOM_OSD = False # Show OSD notifications for events relating to room user is not in -LIST_RELATIVE_CONFIGS = True # Print list of relative configs loaded -SHOW_CONTACT_INFO = True # Displays dev contact details below list in GUI -SHOW_BUTTON_LABELS = True # If disabled, only shows icons for main GUI buttons -SHOW_TOOLTIPS = True - -#Changing these might be ok -DEFAULT_REWIND_THRESHOLD = 4 -SEEK_THRESHOLD = 1 -SLOWDOWN_RATE = 0.95 -DEFAULT_SLOWDOWN_KICKIN_THRESHOLD = 1.5 -SLOWDOWN_RESET_THRESHOLD = 0.1 -MINIMUM_SLOWDOWN_THRESHOLD = 0.2 -DIFFFERENT_DURATION_THRESHOLD = 2.5 -PROTOCOL_TIMEOUT = 12.5 -RECONNECT_RETRIES = 10 -SERVER_STATE_INTERVAL = 1 -WARNING_OSD_MESSAGES_LOOP_INTERVAL = 1 -MERGE_PLAYPAUSE_BUTTONS = False -SYNC_ON_PAUSE = True # Client seek to global position - subtitles may disappear on some media players -#Usually there's no need to adjust these -FILENAME_STRIP_REGEX = u"[-~_\.\[\](): ]" -COMMANDS_UNDO = ["u", "undo", "revert"] -COMMANDS_LIST = ["l", "list", "users"] -COMMANDS_PAUSE = ["p", "play", "pause"] -COMMANDS_ROOM = ["r", "room"] -COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?'] -MPC_MIN_VER = "1.6.4" -VLC_MIN_VERSION = "2.0.0" -VLC_INTERFACE_MIN_VERSION = "0.2.1" -MPC_PATHS = [ - r"C:\Program Files (x86)\MPC-HC\mpc-hc.exe", - r"C:\Program Files\MPC-HC\mpc-hc.exe", - r"C:\Program Files\MPC-HC\mpc-hc64.exe", - r"C:\Program Files\Media Player Classic - Home Cinema\mpc-hc.exe", - r"C:\Program Files\Media Player Classic - Home Cinema\mpc-hc64.exe", - r"C:\Program Files (x86)\Media Player Classic - Home Cinema\mpc-hc.exe", - r"C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe", - r"C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe", - r"C:\Program Files (x86)\Combined Community Codec Pack\MPC\mpc-hc.exe", - r"C:\Program Files\Combined Community Codec Pack\MPC\mpc-hc.exe", - r"C:\Program Files\MPC HomeCinema (x64)\mpc-hc64.exe", - ] -MPLAYER_PATHS = ["mplayer2", "mplayer"] -MPV_PATHS = ["mpv", "/opt/mpv/mpv", r"C:\Program Files\mpv\mpv.exe", r"C:\Program Files\mpv-player\mpv.exe", r"C:\Program Files (x86)\mpv\mpv.exe", r"C:\Program Files (x86)\mpv-player\mpv.exe","/Applications/mpv.app/Contents/MacOS/mpv"] -VLC_PATHS = [ - r"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", - r"C:\Program Files\VideoLAN\VLC\vlc.exe", - "/Applications/VLC.app/Contents/MacOS/VLC" - ] - -VLC_ICONPATH = "vlc.png" -MPLAYER_ICONPATH = "mplayer.png" -MPV_ICONPATH = "mpv.png" -MPC_ICONPATH = "mpc-hc.png" -MPC64_ICONPATH = "mpc-hc64.png" - -#Changing these is usually not something you're looking for -PLAYER_ASK_DELAY = 0.1 -PING_MOVING_AVERAGE_WEIGHT = 0.85 -MPC_OPEN_MAX_WAIT_TIME = 10 -MPC_LOCK_WAIT_TIME = 0.2 -MPC_RETRY_WAIT_TIME = 0.01 -MPC_MAX_RETRIES = 30 -MPC_PAUSE_TOGGLE_DELAY = 0.05 -VLC_OPEN_MAX_WAIT_TIME = 15 -VLC_MIN_PORT = 10000 -VLC_MAX_PORT = 55000 - -#These are not changes you're looking for -MPLAYER_SLAVE_ARGS = [ '-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4'] -# --quiet works with both mpv 0.2 and 0.3 -MPV_SLAVE_ARGS = ['--slave-broken', '--hr-seek=always', '--quiet','--keep-open'] -VLC_SLAVE_ARGS = ['--extraintf=luaintf','--lua-intf=syncplay','--no-quiet','--no-input-fast-seek','--play-and-pause'] -VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance','--no-one-instance-when-started-from-file'] -MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$" -VLC_ANSWER_REGEX = r"(?:^(?P[a-zA-Z_]+)(?:\: )?(?P.*))" -UI_COMMAND_REGEX = r"^(?P[^\ ]+)(?:\ (?P.+))?" -UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P[/+-])?(?P