From 793e55ddbc2b092af112aa6b24c50891a2cd3053 Mon Sep 17 00:00:00 2001 From: Etoh Date: Fri, 15 May 2020 19:23:57 +0100 Subject: [PATCH] Move to JSON IPC API for mpv using iwaltons3's library (#261) (#310) * Separate mpv from mplayer, increase min mpv ver to >= 0.17, refactor * Further separation of mpv from mplayer * Fix reference to isASCII * Add iwalton3's Python MPV JSONIPC library (Apache 2.0) * Move to JSON IPC API for mpv using iwaltons3's library (#261) * Add empty init in Python MPV JSONIPC to make py2exe happy * Use managed version of Python MPV JSONIPC to improve initialisation reliability * Set mpv min version to >=0.29.0 to ensure compatibility * Allow mpv >=0.23.0 based on daniel-123's tests * Update mpv compatibility message * Revert to old OSC compat message * Removed mpv option that's no longer used afer switching to IPC. * Update python-mpv-jsonipc to v1.1.11 * Use python-mpv-jsonipc's mpv quit handler * Shorten mpv paused/position update message Co-authored-by: daniel-123 --- syncplay/constants.py | 14 +- syncplay/players/mpv.py | 470 ++++++++- syncplay/players/mpvnet.py | 4 +- .../players/python_mpv_jsonipc/LICENSE.md | 195 ++++ syncplay/players/python_mpv_jsonipc/README.md | 56 ++ .../players/python_mpv_jsonipc/__init__.py | 0 syncplay/players/python_mpv_jsonipc/docs.md | 460 +++++++++ .../python_mpv_jsonipc/python_mpv_jsonipc.py | 640 ++++++++++++ syncplay/players/python_mpv_jsonipc/setup.py | 25 + syncplay/resources/syncplayintf.lua | 12 + syncplay/resources/third-party-notices.rtf | 952 +++++++++--------- 11 files changed, 2281 insertions(+), 547 deletions(-) create mode 100644 syncplay/players/python_mpv_jsonipc/LICENSE.md create mode 100644 syncplay/players/python_mpv_jsonipc/README.md create mode 100644 syncplay/players/python_mpv_jsonipc/__init__.py create mode 100644 syncplay/players/python_mpv_jsonipc/docs.md create mode 100644 syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py create mode 100644 syncplay/players/python_mpv_jsonipc/setup.py diff --git a/syncplay/constants.py b/syncplay/constants.py index 7cde15200..42da8b096 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -235,9 +235,15 @@ def getValueForOS(constantDict): USERLIST_GUI_FILENAME_COLUMN = 3 MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4', '-af-add', 'scaletempo'] -MPV_ARGS = ['--force-window', '--idle', '--hr-seek=always', '--keep-open'] -MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin'] -MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=duration:${=length:0}}\nANS_path=${path}\n', '--terminal=yes'] +MPV_ARGS = {'force-window': 'yes', + 'idle': 'yes', + 'hr-seek': 'always', + 'keep-open': 'yes', + 'input-terminal': 'no', + 'term-playing-msg': '\nANS_filename=${filename}\nANS_length=${=duration:${=length:0}}\nANS_path=${path}\n', + } + + MPV_NEW_VERSION = False MPV_OSC_VISIBILITY_CHANGE_VERSION = False MPV_INPUT_PROMPT_START_CHARACTER = "〉" @@ -261,7 +267,7 @@ def getValueForOS(constantDict): VLC_SLAVE_EXTRA_ARGS = getValueForOS({ OS_DEFAULT: ['--no-one-instance', '--no-one-instance-when-started-from-file'], OS_MACOS: ['--verbose=2', '--no-file-logging']}) -MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["no-osd set time-pos ", "loadfile "] +MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["set_property time-pos ", "loadfile "] MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"] MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$" VLC_ANSWER_REGEX = r"(?:^(?P[a-zA-Z_]+)(?:\: )?(?P.*))" diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 68beb0d98..eaeb66d57 100755 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -4,17 +4,30 @@ import sys import time import subprocess +import threading +import ast from syncplay import constants -from syncplay.players.mplayer import MplayerPlayer from syncplay.messages import getMessage from syncplay.utils import isURL, findResourcePath +from syncplay.utils import isMacOS, isWindows, isASCII +from syncplay.players.python_mpv_jsonipc.python_mpv_jsonipc import MPV +from syncplay.players.basePlayer import BasePlayer -class MpvPlayer(MplayerPlayer): +class MpvPlayer(BasePlayer): RE_VERSION = re.compile(r'.*mpv (\d+)\.(\d+)\.\d+.*') osdMessageSeparator = "\\n" osdMessageSeparator = "; " # TODO: Make conditional + POSITION_QUERY = 'time-pos' + OSD_QUERY = 'show_text' + RE_ANSWER = re.compile(constants.MPLAYER_ANSWER_REGEX) + lastResetTime = None + lastMPVPositionUpdate = None + alertOSDSupported = True + chatOSDSupported = True + speedSupported = True + customOpenDialog = False @staticmethod def run(client, playerPath, filePath, args): @@ -22,26 +35,41 @@ def run(client, playerPath, filePath, args): ver = MpvPlayer.RE_VERSION.search(subprocess.check_output([playerPath, '--version']).decode('utf-8')) except: ver = None - constants.MPV_NEW_VERSION = ver is None or int(ver.group(1)) > 0 or int(ver.group(2)) >= 6 + constants.MPV_NEW_VERSION = ver is None or int(ver.group(1)) > 0 or int(ver.group(2)) >= 23 + if not constants.MPV_NEW_VERSION: + from twisted.internet import reactor + the_reactor = reactor + the_reactor.callFromThread(client.ui.showErrorMessage, + "This version of mpv is not compatible with Syncplay. " + "Please use mpv >=0.23.0.", True) + the_reactor.callFromThread(client.stop) + return + constants.MPV_OSC_VISIBILITY_CHANGE_VERSION = False if ver is None else int(ver.group(1)) > 0 or int(ver.group(2)) >= 28 if not constants.MPV_OSC_VISIBILITY_CHANGE_VERSION: client.ui.showDebugMessage( "This version of mpv is not known to be compatible with changing the OSC visibility. " "Please use mpv >=0.28.0.") - if constants.MPV_NEW_VERSION: - return NewMpvPlayer(client, MpvPlayer.getExpandedPath(playerPath), filePath, args) - else: - return OldMpvPlayer(client, MpvPlayer.getExpandedPath(playerPath), filePath, args) + return MpvPlayer(client, MpvPlayer.getExpandedPath(playerPath), filePath, args) @staticmethod - def getStartupArgs(path, userArgs): + def getStartupArgs(userArgs): args = constants.MPV_ARGS + args["script"] = findResourcePath("syncplayintf.lua") if userArgs: - args.extend(userArgs) - args.extend(constants.MPV_SLAVE_ARGS) - if constants.MPV_NEW_VERSION: - args.extend(constants.MPV_SLAVE_ARGS_NEW) - args.extend(["--script={}".format(findResourcePath("syncplayintf.lua"))]) + for argToAdd in userArgs: + if argToAdd.startswith('--'): + argToAdd = argToAdd[2:] + elif argToAdd.startswith('-'): + argToAdd = argToAdd[1:] + if argToAdd.strip() == "": + continue + if "=" in argToAdd: + (argName, argValue) = argToAdd.split("=") + else: + argName = argToAdd + argValue = "yes" + args[argName] = argValue return args @staticmethod @@ -83,18 +111,8 @@ def getIconPath(path): def getPlayerPathErrors(playerPath, filePath): return None - -class OldMpvPlayer(MpvPlayer): - POSITION_QUERY = 'time-pos' - OSD_QUERY = 'show_text' - def _setProperty(self, property_, value): - self._listener.sendLine("no-osd set {} {}".format(property_, value)) - - def setPaused(self, value): - if self._paused != value: - self._paused = not self._paused - self._listener.sendLine('cycle pause') + self._listener.sendLine(["set_property", property_, value]) def mpvErrorCheck(self, line): if "Error parsing option" in line or "Error parsing commandline option" in line: @@ -107,41 +125,30 @@ def mpvErrorCheck(self, line): if constants and any(errormsg in line for errormsg in constants.MPV_ERROR_MESSAGES_TO_REPEAT): self._client.ui.showErrorMessage(line) - def _handleUnknownLine(self, line): - self.mpvErrorCheck(line) - if "Playing: " in line: - newpath = line[9:] - oldpath = self._filepath - if newpath != oldpath and oldpath is not None: - self.reactor.callFromThread(self._onFileUpdate) - if self._paused != self._client.getGlobalPaused(): - self.setPaused(self._client.getGlobalPaused()) - self.setPosition(self._client.getGlobalPosition()) - - -class NewMpvPlayer(OldMpvPlayer): - lastResetTime = None - lastMPVPositionUpdate = None - alertOSDSupported = True - chatOSDSupported = True - def displayMessage(self, message, duration=(constants.OSD_DURATION * 1000), OSDType=constants.OSD_NOTIFICATION, mood=constants.MESSAGE_NEUTRAL): if not self._client._config["chatOutputEnabled"]: - MplayerPlayer.displayMessage(self, message=message, duration=duration, OSDType=OSDType, mood=mood) + messageString = self._sanitizeText(message.replace("\\n", "")).replace("", "\\n") + self._listener.mpvpipe.show_text(messageString, duration, constants.MPLAYER_OSD_LEVEL) return messageString = self._sanitizeText(message.replace("\\n", "")).replace( "\\\\", constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER).replace("", "\\n") - self._listener.sendLine('script-message-to syncplayintf {}-osd-{} "{}"'.format(OSDType, mood, messageString)) + self._listener.sendLine(["script-message-to", "syncplayintf", "{}-osd-{}".format(OSDType, mood), messageString]) def displayChatMessage(self, username, message): if not self._client._config["chatOutputEnabled"]: - MplayerPlayer.displayChatMessage(self, username, message) + messageString = "<{}> {}".format(username, message) + messageString = self._sanitizeText(messageString.replace("\\n", "")).replace("", "\\n") + duration = int(constants.OSD_DURATION * 1000) + self._listener.mpvpipe.show_text(messageString, duration, constants.MPLAYER_OSD_LEVEL) return username = self._sanitizeText(username.replace("\\", constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER)) message = self._sanitizeText(message.replace("\\", constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER)) messageString = "<{}> {}".format(username, message) - self._listener.sendLine('script-message-to syncplayintf chat "{}"'.format(messageString)) + self._listener.sendLine(["script-message-to", "syncplayintf", "chat", messageString]) + + def setSpeed(self, value): + self._setProperty('speed', "{:.2f}".format(value)) def setPaused(self, value): if self._paused == value: @@ -153,6 +160,15 @@ def setPaused(self, value): if value == False: self.lastMPVPositionUpdate = time.time() + def _getFilename(self): + self._getProperty('filename') + + def _getLength(self): + self._getProperty('length') + + def _getFilepath(self): + self._getProperty('path') + def _getProperty(self, property_): floatProperties = ['time-pos'] if property_ in floatProperties: @@ -161,7 +177,7 @@ def _getProperty(self, property_): propertyID = '=duration:${=length:0}' else: propertyID = property_ - self._listener.sendLine("print_text ""ANS_{}=${{{}}}""".format(property_, propertyID)) + self._listener.sendLine(["print_text", '"ANS_{}=${{{}}}"'.format(property_, propertyID)]) def getCalculatedPosition(self): if self.fileLoaded == False: @@ -197,6 +213,10 @@ def getCalculatedPosition(self): return self._position def _storePosition(self, value): + if value is None: + self._client.ui.showDebugMessage("NONE TYPE POSITION!") + return + if self._client.isPlayingMusic() and self._paused == False and self._position == value and abs(self._position-self._position) < 0.5: self._client.ui.showDebugMessage("EOF DETECTED!") self._position = 0 @@ -206,17 +226,79 @@ def _storePosition(self, value): self._client.ui.showDebugMessage("Recently reset, so storing position as 0") self._position = 0 elif self._fileIsLoaded() or (value < constants.MPV_NEWFILE_IGNORE_TIME and self._fileIsLoaded(ignoreDelay=True)): + old_position = float(self._position) self._position = max(value, 0) + #self._client.ui.showDebugMessage("Position changed from {} to {}".format(old_position, self._position)) else: self._client.ui.showDebugMessage( - "No file loaded so storing position as GlobalPosition ({})".format(self._client.getGlobalPosition())) + "No file loaded so storing position {} as GlobalPosition ({})".format(value, self._client.getGlobalPosition())) self._position = self._client.getGlobalPosition() def _storePauseState(self, value): + if value is None: + self._client.ui.showDebugMessage("NONE TYPE PAUSE STATE!") + return if self._fileIsLoaded(): self._paused = value + #self._client.ui.showDebugMessage("PAUSE STATE STORED AS {}".format(self._paused)) else: self._paused = self._client.getGlobalPaused() + #self._client.ui.showDebugMessage("STORING GLOBAL PAUSED AS FILE IS NOT LOADED") + + + def lineReceived(self, line): + if line: + self._client.ui.showDebugMessage("player << {}".format(line)) + line = line.replace("[cplayer] ", "") # -v workaround + line = line.replace("[term-msg] ", "") # -v workaround + line = line.replace(" cplayer: ", "") # --msg-module workaround + line = line.replace(" term-msg: ", "") + if ( + "Failed to get value of property" in line or + "=(unavailable)" in line or + line == "ANS_filename=" or + line == "ANS_length=" or + line == "ANS_path=" + ): + if "filename" in line: + self._getFilename() + elif "length" in line: + self._getLength() + elif "path" in line: + self._getFilepath() + return + match = self.RE_ANSWER.match(line) + if not match: + self._handleUnknownLine(line) + return + + name, value = [m for m in match.groups() if m] + name = name.lower() + + if name == self.POSITION_QUERY: + self._storePosition(float(value)) + self._positionAsk.set() + elif name == "pause": + self._storePauseState(bool(value == 'yes')) + self._pausedAsk.set() + elif name == "length": + try: + self._duration = float(value) + except: + self._duration = 0 + self._durationAsk.set() + elif name == "path": + self._filepath = value + self._pathAsk.set() + elif name == "filename": + self._filename = value + self._filenameAsk.set() + elif name == "exiting": + if value != 'Quit': + if self.quitReason is None: + self.quitReason = getMessage("media-player-error").format(value) + self.reactor.callFromThread(self._client.ui.showErrorMessage, self.quitReason, True) + self.drop() def askForStatus(self): self._positionAsk.clear() @@ -231,8 +313,47 @@ def askForStatus(self): self._client.updatePlayerStatus( self._paused if self.fileLoaded else self._client.getGlobalPaused(), self.getCalculatedPosition()) + def drop(self): + self._listener.sendLine(['quit']) + self._takeLocksDown() + self.reactor.callFromThread(self._client.stop, False) + + def _takeLocksDown(self): + self._durationAsk.set() + self._filenameAsk.set() + self._pathAsk.set() + self._positionAsk.set() + self._pausedAsk.set() + + def _getPausedAndPosition(self): - self._listener.sendLine("print_text ANS_pause=${pause}\r\nprint_text ANS_time-pos=${=time-pos}") + self._listener.sendLine(["script-message-to", "syncplayintf", "get_paused_and_position"]) + + def _getPaused(self): + self._getProperty('pause') + + def _getPosition(self): + self._getProperty(self.POSITION_QUERY) + + def _sanitizeText(self, text): + text = text.replace("\r", "") + text = text.replace("\n", "") + text = text.replace("\\\"", "") + text = text.replace("\"", "") + text = text.replace("%", "%%") + text = text.replace("\\", "\\\\") + text = text.replace("{", "\\\\{") + text = text.replace("}", "\\\\}") + text = text.replace("", "\\\"") + return text + + def _quoteArg(self, arg): + arg = arg.replace('\\', '\\\\') + arg = arg.replace("'", "\\'") + arg = arg.replace('"', '\\"') + arg = arg.replace("\r", "") + arg = arg.replace("\n", "") + return '"{}"'.format(arg) def _preparePlayer(self): if self.delayedFilePath: @@ -246,7 +367,7 @@ def _clearFileLoaded(self): def _loadFile(self, filePath): self._clearFileLoaded() - self._listener.sendLine('loadfile {}'.format(self._quoteArg(filePath)), notReadyAfterThis=True) + self._listener.sendLine(['loadfile', filePath], notReadyAfterThis=True) def setFeatures(self, featureList): self.sendMpvOptions() @@ -256,7 +377,11 @@ def setPosition(self, value): self._client.ui.showDebugMessage( "Did not seek as recently reset and {} below 'do not reset position' threshold".format(value)) return - MplayerPlayer.setPosition(self, value) + self._position = max(value, 0) + self._client.ui.showDebugMessage( + "Setting position to {}...".format(self._position)) + self._setProperty(self.POSITION_QUERY, "{}".format(value)) + time.sleep(0.03) self.lastMPVPositionUpdate = time.time() def openFile(self, filePath, resetPosition=False): @@ -264,6 +389,7 @@ def openFile(self, filePath, resetPosition=False): if resetPosition: self.lastResetTime = time.time() if isURL(filePath): + self._client.ui.showDebugMessage("Setting additional lastResetTime due to stream") self.lastResetTime += constants.STREAM_ADDITIONAL_IGNORE_TIME self._loadFile(filePath) if self._paused != self._client.getGlobalPaused(): @@ -271,9 +397,11 @@ def openFile(self, filePath, resetPosition=False): else: self._client.ui.showDebugMessage("Don't want to set paused to {}".format(self._client.getGlobalPaused())) if resetPosition == False: + self._client.ui.showDebugMessage("OpenFile setting position to global position: {}".format(self._client.getGlobalPosition())) self.setPosition(self._client.getGlobalPosition()) else: self._storePosition(0) + # TO TRY: self._listener.setReadyToSend(False) def sendMpvOptions(self): options = [] @@ -285,7 +413,7 @@ def sendMpvOptions(self): options.append("{}={}".format(option, getMessage(option))) options.append("OscVisibilityChangeCompatible={}".format(constants.MPV_OSC_VISIBILITY_CHANGE_VERSION)) options_string = ", ".join(options) - self._listener.sendLine('script-message-to syncplayintf set_syncplayintf_options "{}"'.format(options_string)) + self._listener.sendLine(["script-message-to", "syncplayintf", "set_syncplayintf_options", options_string]) self._setOSDPosition() def _handleUnknownLine(self, line): @@ -295,18 +423,37 @@ def _handleUnknownLine(self, line): line = line.replace(constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER, "\\") self._listener.sendChat(line[6:-7]) + if "", "<").replace("=", "<").replace(", ", "<").split("<") + paused_update = update_string[2] + position_update = update_string[4] + if paused_update == "nil": + self._storePauseState(True) + else: + self._storePauseState(bool(paused_update == 'true')) + self._pausedAsk.set() + if position_update == "nil": + self._storePosition(float(0)) + else: + self._storePosition(float(position_update)) + self._positionAsk.set() + #self._client.ui.showDebugMessage("{} = {} / {}".format(update_string, paused_update, position_update)) + if "" in line: self.sendMpvOptions() if line == "" or "Playing:" in line: + self._client.ui.showDebugMessage("Not ready to send due to ") self._listener.setReadyToSend(False) self._clearFileLoaded() elif line == "": self._onFileUpdate() self._listener.setReadyToSend(True) + self._client.ui.showDebugMessage("Ready to send due to ") elif "Failed" in line or "failed" in line or "No video or audio streams selected" in line or "error" in line: + self._client.ui.showDebugMessage("Not ready to send due to error") self._listener.setReadyToSend(True) def _setOSDPosition(self): @@ -330,12 +477,15 @@ def _recentlyReset(self): return False def _onFileUpdate(self): + self._client.ui.showDebugMessage("File update") self.fileLoaded = True self.lastLoadedTime = time.time() self.reactor.callFromThread(self._client.updateFile, self._filename, self._duration, self._filepath) if not (self._recentlyReset()): + self._client.ui.showDebugMessage("onFileUpdate setting position to global position: {}".format(self._client.getGlobalPosition())) self.reactor.callFromThread(self.setPosition, self._client.getGlobalPosition()) if self._paused != self._client.getGlobalPaused(): + self._client.ui.showDebugMessage("onFileUpdate setting position to global paused: {}".format(self._client.getGlobalPaused())) self.reactor.callFromThread(self._client.getGlobalPaused) def _fileIsLoaded(self, ignoreDelay=False): @@ -347,3 +497,219 @@ def _fileIsLoaded(self, ignoreDelay=False): self.fileLoaded and self.lastLoadedTime is not None and time.time() > (self.lastLoadedTime + constants.MPV_NEWFILE_IGNORE_TIME) ) + + + def __init__(self, client, playerPath, filePath, args): + from twisted.internet import reactor + self.reactor = reactor + self._client = client + self._paused = None + self._position = 0.0 + self._duration = None + self._filename = None + self._filepath = None + self.quitReason = None + self.lastLoadedTime = None + self.fileLoaded = False + self.delayedFilePath = None + try: + self._listener = self.__Listener(self, playerPath, filePath, args) + except ValueError: + self._client.ui.showMessage(getMessage("mplayer-file-required-notification")) + self._client.ui.showMessage(getMessage("mplayer-file-required-notification/example")) + self.drop() + return + self._listener.setDaemon(True) + self._listener.start() + + self._durationAsk = threading.Event() + self._filenameAsk = threading.Event() + self._pathAsk = threading.Event() + + self._positionAsk = threading.Event() + self._pausedAsk = threading.Event() + + self._preparePlayer() + + def _fileUpdateClearEvents(self): + self._durationAsk.clear() + self._filenameAsk.clear() + self._pathAsk.clear() + + def _fileUpdateWaitEvents(self): + self._durationAsk.wait() + self._filenameAsk.wait() + self._pathAsk.wait() + + def mpv_log_handler(self, level, prefix, text): + self.lineReceived(text) + + class __Listener(threading.Thread): + def __init__(self, playerController, playerPath, filePath, args): + self.playerPath = playerPath + self.mpv_arguments = playerController.getStartupArgs(args) + self.mpv_running = True + self.sendQueue = [] + self.readyToSend = True + self.lastSendTime = None + self.lastNotReadyTime = None + self.__playerController = playerController + if not self.__playerController._client._config["chatOutputEnabled"]: + self.__playerController.alertOSDSupported = False + self.__playerController.chatOSDSupported = False + if self.__playerController.getPlayerPathErrors(playerPath, filePath): + raise ValueError() + 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) + + if filePath: + self.__playerController.delayedFilePath = filePath + + # At least mpv may output escape sequences which result in syncplay + # trying to parse something like + # "\x1b[?1l\x1b>ANS_filename=blah.mkv". Work around this by + # unsetting TERM. + env = os.environ.copy() + if 'TERM' in env: + del env['TERM'] + # On macOS, youtube-dl requires system python to run. Set the environment + # to allow that version of python to be executed in the mpv subprocess. + if isMacOS(): + try: + pythonLibs = subprocess.check_output(['/usr/bin/python', '-E', '-c', + 'import sys; print(sys.path)'], + text=True, env=dict()) + pythonLibs = ast.literal_eval(pythonLibs) + pythonPath = ':'.join(pythonLibs[1:]) + except: + pythonPath = None + if pythonPath is not None: + env['PATH'] = '/usr/bin:/usr/local/bin' + env['PYTHONPATH'] = pythonPath + self.mpvpipe = MPV(mpv_location=self.playerPath, loglevel="info", log_handler=self.__playerController.mpv_log_handler, quit_callback=self.stop_client, **self.mpv_arguments) + self.__process = self.mpvpipe + #self.mpvpipe.show_text("HELLO WORLD!", 1000) + threading.Thread.__init__(self, name="MPV 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: + cwd = env['HOME'] + elif 'APPDATA' in env: + cwd = env['APPDATA'] + else: + cwd = None + return cwd + + def run(self): + pass + + def sendChat(self, message): + if message: + if message[:1] == "/" and message != "/": + command = message[1:] + if command and command[:1] == "/": + message = message[1:] + else: + self.__playerController.reactor.callFromThread( + self.__playerController._client.ui.executeCommand, command) + return + self.__playerController.reactor.callFromThread(self.__playerController._client.sendChat, message) + + def isReadyForSend(self): + self.checkForReadinessOverride() + return self.readyToSend + + def setReadyToSend(self, newReadyState): + oldState = self.readyToSend + self.readyToSend = newReadyState + self.lastNotReadyTime = time.time() if newReadyState == False else None + if self.readyToSend == True: + self.__playerController._client.ui.showDebugMessage(" Ready to send: True") + else: + self.__playerController._client.ui.showDebugMessage(" Ready to send: False") + if self.readyToSend == True and oldState == False: + self.processSendQueue() + + def checkForReadinessOverride(self): + if self.lastNotReadyTime and time.time() - self.lastNotReadyTime > constants.MPV_MAX_NEWFILE_COOLDOWN_TIME: + self.setReadyToSend(True) + + def sendLine(self, line, notReadyAfterThis=None): + self.checkForReadinessOverride() + try: + if self.sendQueue: + if constants.MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS: + for command in constants.MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS: + line_command = " ".join(line) + answer = line_command.startswith(command) + #self.__playerController._client.ui.showDebugMessage("Does line_command {} start with {}? {}".format(line_command, command, answer)) + if line_command.startswith(command): + for itemID, deletionCandidate in enumerate(self.sendQueue): + if " ".join(deletionCandidate).startswith(command): + self.__playerController._client.ui.showDebugMessage( + " Remove duplicate (supersede): {}".format(self.sendQueue[itemID])) + try: + self.sendQueue.remove(self.sendQueue[itemID]) + except UnicodeWarning: + self.__playerController._client.ui.showDebugMessage( + " Unicode mismatch occured when trying to remove duplicate") + # TODO: Prevent this from being triggered + pass + break + break + if constants.MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS: + for command in constants.MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS: + if line == command: + for itemID, deletionCandidate in enumerate(self.sendQueue): + if deletionCandidate == command: + self.__playerController._client.ui.showDebugMessage( + " Remove duplicate (delete both): {}".format(self.sendQueue[itemID])) + self.__playerController._client.ui.showDebugMessage(self.sendQueue[itemID]) + return + except Exception as e: + self.__playerController._client.ui.showDebugMessage(" Problem removing duplicates, etc: {}".format(e)) + self.sendQueue.append(line) + self.processSendQueue() + if notReadyAfterThis: + self.setReadyToSend(False) + + def processSendQueue(self): + while self.sendQueue and self.readyToSend: + if self.lastSendTime and time.time() - self.lastSendTime < constants.MPV_SENDMESSAGE_COOLDOWN_TIME: + self.__playerController._client.ui.showDebugMessage( + " Throttling message send, so sleeping for {}".format( + constants.MPV_SENDMESSAGE_COOLDOWN_TIME)) + time.sleep(constants.MPV_SENDMESSAGE_COOLDOWN_TIME) + try: + lineToSend = self.sendQueue.pop() + if lineToSend: + self.lastSendTime = time.time() + self.actuallySendLine(lineToSend) + except IndexError: + pass + + def stop_client(self): + self.readyToSend = False + try: + self.mpvpipe.terminate() + except: #When mpv is already closed + pass + self.__playerController._takeLocksDown() + self.__playerController.reactor.callFromThread(self.__playerController._client.stop, False) + + def actuallySendLine(self, line): + try: + self.__playerController._client.ui.showDebugMessage("player >> {}".format(line)) + try: + self.mpvpipe.command(*line) + except Exception as e: + self.__playerController._client.ui.showDebugMessage("CANNOT SEND {} DUE TO {}".format(line, e)) + self.stop_client() + except IOError: + pass diff --git a/syncplay/players/mpvnet.py b/syncplay/players/mpvnet.py index 5813e3734..41088d540 100644 --- a/syncplay/players/mpvnet.py +++ b/syncplay/players/mpvnet.py @@ -1,8 +1,8 @@ import os from syncplay import constants -from syncplay.players.mpv import NewMpvPlayer +from syncplay.players.mpv import MpvPlayer -class MpvnetPlayer(NewMpvPlayer): +class MpvnetPlayer(MpvPlayer): @staticmethod diff --git a/syncplay/players/python_mpv_jsonipc/LICENSE.md b/syncplay/players/python_mpv_jsonipc/LICENSE.md new file mode 100644 index 000000000..f5f4b8b5e --- /dev/null +++ b/syncplay/players/python_mpv_jsonipc/LICENSE.md @@ -0,0 +1,195 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/syncplay/players/python_mpv_jsonipc/README.md b/syncplay/players/python_mpv_jsonipc/README.md new file mode 100644 index 000000000..cc3cea7c5 --- /dev/null +++ b/syncplay/players/python_mpv_jsonipc/README.md @@ -0,0 +1,56 @@ +# Python MPV JSONIPC + +This implements an interface similar to `python-mpv`, but it uses the JSON IPC protocol instead of the C API. This means +you can control external instances of MPV including players like SMPlayer, and it can use MPV players that are prebuilt +instead of needing `libmpv1`. It may also be more resistant to crashes such as Segmentation Faults, but since it isn't +directly communicating with MPV via the C API the performance will be worse. + +Please note that this only implements the subset of `python-mpv` that is used by `plex-mpv-shim` and +`jellyfin-mpv-shim`. Other functionality has not been implemented. + +## Installation + +```bash +sudo pip3 install python-mpv-jsonipc +``` + +## Basic usage + +Create an instance of MPV. You can use an already running MPV or have the library start a +managed copy of MPV. Command arguments can be specified when initializing MPV if you are +starting a managed copy of MPV. + +Please also see the [API Documentation](https://github.com/iwalton3/python-mpv-jsonipc/blob/master/docs.md). + +```python +from python_mpv_jsonipc import MPV + +# Uses MPV that is in the PATH. +mpv = MPV() + +# Use MPV that is running and connected to /tmp/mpv-socket. +mpv = MPV(start_mpv=False, ipc_socket="/tmp/mpv-socket") + +# Uses MPV that is found at /path/to/mpv. +mpv = MPV(mpv_location="/path/to/mpv") + +# After you have an MPV, you can read and set (if applicable) properties. +mpv.volume # 100.0 by default +mpv.volume = 20 + +# You can also send commands. +mpv.command_name(arg1, arg2) + +# Bind to key press events with a decorator +@mpv.on_key_press("space") +def space_handler(): + pass + +# You can also observe and wait for properties. +@mpv.property_observer("eof-reached") +def handle_eof(name, value): + pass + +# Or simply wait for the value to change once. +mpv.wait_for_property("duration") +``` diff --git a/syncplay/players/python_mpv_jsonipc/__init__.py b/syncplay/players/python_mpv_jsonipc/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/syncplay/players/python_mpv_jsonipc/docs.md b/syncplay/players/python_mpv_jsonipc/docs.md new file mode 100644 index 000000000..e3146c9be --- /dev/null +++ b/syncplay/players/python_mpv_jsonipc/docs.md @@ -0,0 +1,460 @@ + + +## python\_mpv\_jsonipc + + + +### MPVError + +``` python +class MPVError(Exception): + | MPVError(**args, ****kwargs) +``` + +An error originating from MPV or due to a problem with MPV. + + + +### WindowsSocket + +``` python +class WindowsSocket(threading.Thread) +``` + +Wraps a Windows named pipe in a high-level interface. (Internal) + +Data is automatically encoded and decoded as JSON. The callback +function will be called for each inbound message. + + + +#### \_\_init\_\_ + +``` python + | __init__(ipc_socket, callback=None, quit_callback=None) +``` + +Create the wrapper. + +**ipc\_socket** is the pipe name. (Not including \\\\.\\pipe\\) +**callback(json\_data)** is the function for recieving events. + + + +#### stop + +``` python + | stop() +``` + +Terminate the thread. + + + +#### send + +``` python + | send(data) +``` + +Send **data** to the pipe, encoded as JSON. + + + +#### run + +``` python + | run() +``` + +Process pipe events. Do not run this directly. Use **start**. + + + +### UnixSocket + +``` python +class UnixSocket(threading.Thread) +``` + +Wraps a Unix/Linux socket in a high-level interface. (Internal) + +Data is automatically encoded and decoded as JSON. The callback +function will be called for each inbound message. + + + +#### \_\_init\_\_ + +``` python + | __init__(ipc_socket, callback=None, quit_callback=None) +``` + +Create the wrapper. + +**ipc\_socket** is the path to the socket. +**callback(json\_data)** is the function for recieving events. + + + +#### stop + +``` python + | stop() +``` + +Terminate the thread. + + + +#### send + +``` python + | send(data) +``` + +Send **data** to the socket, encoded as JSON. + + + +#### run + +``` python + | run() +``` + +Process socket events. Do not run this directly. Use **start**. + + + +### MPVProcess + +``` python +class MPVProcess() +``` + +Manages an MPV process, ensuring the socket or pipe is available. (Internal) + + + +#### \_\_init\_\_ + +``` python + | __init__(ipc_socket, mpv_location=None, ****kwargs) +``` + +Create and start the MPV process. Will block until socket/pipe is available. + +**ipc\_socket** is the path to the Unix/Linux socket or name of the Windows pipe. +**mpv\_location** is the path to mpv. If left unset it tries the one in the PATH. + +All other arguments are forwarded to MPV as command-line arguments. + + + +#### stop + +``` python + | stop() +``` + +Terminate the process. + + + +### MPVInter + +``` python +class MPVInter() +``` + +Low-level interface to MPV. Does NOT manage an mpv process. (Internal) + + + +#### \_\_init\_\_ + +``` python + | __init__(ipc_socket, callback=None, quit_callback=None) +``` + +Create the wrapper. + +**ipc\_socket** is the path to the Unix/Linux socket or name of the Windows pipe. +**callback(event\_name, data)** is the function for recieving events. + + + +#### stop + +``` python + | stop() +``` + +Terminate the underlying connection. + + + +#### event\_callback + +``` python + | event_callback(data) +``` + +Internal callback for recieving events from MPV. + + + +#### command + +``` python + | command(command, **args) +``` + +Issue a command to MPV. Will block until completed or timeout is reached. + +**command** is the name of the MPV command + +All further arguments are forwarded to the MPV command. +Throws TimeoutError if timeout of 120 seconds is reached. + + + +### EventHandler + +``` python +class EventHandler(threading.Thread) +``` + +Event handling thread. (Internal) + + + +#### \_\_init\_\_ + +``` python + | __init__() +``` + +Create an instance of the thread. + + + +#### put\_task + +``` python + | put_task(func, **args) +``` + +Put a new task to the thread. + +**func** is the function to call + +All further arguments are forwarded to **func**. + + + +#### stop + +``` python + | stop() +``` + +Terminate the thread. + + + +#### run + +``` python + | run() +``` + +Process socket events. Do not run this directly. Use **start**. + + + +### MPV + +``` python +class MPV() +``` + +The main MPV interface class. Use this to control MPV. + +This will expose all mpv commands as callable methods and all properties. +You can set properties and call the commands directly. + +Please note that if you are using a really old MPV version, a fallback command +list is used. Not all commands may actually work when this fallback is used. + + + +#### \_\_init\_\_ + +``` python + | __init__(start_mpv=True, ipc_socket=None, mpv_location=None, log_handler=None, loglevel=None, quit_callback=None, ****kwargs) +``` + +Create the interface to MPV and process instance. + +**start\_mpv** will start an MPV process if true. (Default: True) +**ipc\_socket** is the path to the Unix/Linux socket or name of Windows pipe. (Default: Random Temp File) +**mpv\_location** is the location of MPV for **start\_mpv**. (Default: Use MPV in PATH) +**log\_handler(level, prefix, text)** is an optional handler for log events. (Default: Disabled) +**loglevel** is the level for log messages. Levels are fatal, error, warn, info, v, debug, trace. (Default: Disabled) + +All other arguments are forwarded to MPV as command-line arguments if **start\_mpv** is used. + + + +#### bind\_event + +``` python + | bind_event(name, callback) +``` + +Bind a callback to an MPV event. + +**name** is the MPV event name. +**callback(event\_data)** is the function to call. + + + +#### on\_event + +``` python + | on_event(name) +``` + +Decorator to bind a callback to an MPV event. + +@on\_event(name) +def my\_callback(event\_data): +pass + + + +#### event\_callback + +``` python + | event_callback(name) +``` + +An alias for on\_event to maintain compatibility with python-mpv. + + + +#### on\_key\_press + +``` python + | on_key_press(name) +``` + +Decorator to bind a callback to an MPV keypress event. + +@on\_key\_press(key\_name) +def my\_callback(): +pass + + + +#### bind\_key\_press + +``` python + | bind_key_press(name, callback) +``` + +Bind a callback to an MPV keypress event. + +**name** is the key symbol. +**callback()** is the function to call. + + + +#### bind\_property\_observer + +``` python + | bind_property_observer(name, callback) +``` + +Bind a callback to an MPV property change. + +**name** is the property name. +**callback(name, data)** is the function to call. + +Returns a unique observer ID needed to destroy the observer. + + + +#### unbind\_property\_observer + +``` python + | unbind_property_observer(observer_id) +``` + +Remove callback to an MPV property change. + +**observer\_id** is the id returned by bind\_property\_observer. + + + +#### property\_observer + +``` python + | property_observer(name) +``` + +Decorator to bind a callback to an MPV property change. + +@property\_observer(property\_name) +def my\_callback(name, data): +pass + + + +#### wait\_for\_property + +``` python + | wait_for_property(name) +``` + +Waits for the value of a property to change. + +**name** is the name of the property. + + + +#### play + +``` python + | play(url) +``` + +Play the specified URL. An alias to loadfile(). + + + +#### terminate + +``` python + | terminate() +``` + +Terminate the connection to MPV and process (if **start\_mpv** is used). + + + +#### command + +``` python + | command(command, **args) +``` + +Send a command to MPV. All commands are bound to the class by default, +except JSON IPC specific commands. This may also be useful to retain +compatibility with python-mpv, as it does not bind all of the commands. + +**command** is the command name. + +All further arguments are forwarded to the MPV command. diff --git a/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py b/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py new file mode 100644 index 000000000..993606b69 --- /dev/null +++ b/syncplay/players/python_mpv_jsonipc/python_mpv_jsonipc.py @@ -0,0 +1,640 @@ +import threading +import socket +import json +import os +import time +import subprocess +import random +import queue +import logging + +log = logging.getLogger('mpv-jsonipc') + +if os.name == "nt": + import _winapi + from multiprocessing.connection import PipeConnection + +TIMEOUT = 120 + +# Older MPV versions do not allow us to dynamically retrieve the command list. +FALLBACK_COMMAND_LIST = [ + 'ignore', 'seek', 'revert-seek', 'quit', 'quit-watch-later', 'stop', 'frame-step', 'frame-back-step', + 'playlist-next', 'playlist-prev', 'playlist-shuffle', 'playlist-unshuffle', 'sub-step', 'sub-seek', + 'print-text', 'show-text', 'expand-text', 'expand-path', 'show-progress', 'sub-add', 'audio-add', + 'video-add', 'sub-remove', 'audio-remove', 'video-remove', 'sub-reload', 'audio-reload', 'video-reload', + 'rescan-external-files', 'screenshot', 'screenshot-to-file', 'screenshot-raw', 'loadfile', 'loadlist', + 'playlist-clear', 'playlist-remove', 'playlist-move', 'run', 'subprocess', 'set', 'change-list', 'add', + 'cycle', 'multiply', 'cycle-values', 'enable-section', 'disable-section', 'define-section', 'ab-loop', + 'drop-buffers', 'af', 'vf', 'af-command', 'vf-command', 'ao-reload', 'script-binding', 'script-message', + 'script-message-to', 'overlay-add', 'overlay-remove', 'osd-overlay', 'write-watch-later-config', + 'hook-add', 'hook-ack', 'mouse', 'keybind', 'keypress', 'keydown', 'keyup', 'apply-profile', + 'load-script', 'dump-cache', 'ab-loop-dump-cache', 'ab-loop-align-cache'] + +class MPVError(Exception): + """An error originating from MPV or due to a problem with MPV.""" + def __init__(self, *args, **kwargs): + super(MPVError, self).__init__(*args, **kwargs) + +class WindowsSocket(threading.Thread): + """ + Wraps a Windows named pipe in a high-level interface. (Internal) + + Data is automatically encoded and decoded as JSON. The callback + function will be called for each inbound message. + """ + def __init__(self, ipc_socket, callback=None, quit_callback=None): + """Create the wrapper. + + *ipc_socket* is the pipe name. (Not including \\\\.\\pipe\\) + *callback(json_data)* is the function for recieving events. + *quit_callback* is called when the socket connection dies. + """ + ipc_socket = "\\\\.\\pipe\\" + ipc_socket + self.callback = callback + self.quit_callback = quit_callback + + access = _winapi.GENERIC_READ | _winapi.GENERIC_WRITE + limit = 5 # Connection may fail at first. Try 5 times. + for _ in range(limit): + try: + pipe_handle = _winapi.CreateFile( + ipc_socket, access, 0, _winapi.NULL, _winapi.OPEN_EXISTING, + _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL + ) + break + except OSError: + time.sleep(1) + else: + raise MPVError("Cannot connect to pipe.") + self.socket = PipeConnection(pipe_handle) + + if self.callback is None: + self.callback = lambda data: None + + threading.Thread.__init__(self) + + def stop(self, join=True): + """Terminate the thread.""" + if self.socket is not None: + self.socket.close() + if join: + self.join() + + def send(self, data): + """Send *data* to the pipe, encoded as JSON.""" + try: + self.socket.send_bytes(json.dumps(data).encode('utf-8') + b'\n') + except OSError as ex: + if len(ex.args) == 1 and ex.args[0] == "handle is closed": + raise BrokenPipeError("handle is closed") + raise ex + + def run(self): + """Process pipe events. Do not run this directly. Use *start*.""" + data = b'' + try: + while True: + current_data = self.socket.recv_bytes(2048) + if current_data == b'': + break + + data += current_data + if data[-1] != 10: + continue + + data = data.decode('utf-8', 'ignore').encode('utf-8') + for item in data.split(b'\n'): + if item == b'': + continue + json_data = json.loads(item) + self.callback(json_data) + data = b'' + except EOFError: + if self.quit_callback: + self.quit_callback() + +class UnixSocket(threading.Thread): + """ + Wraps a Unix/Linux socket in a high-level interface. (Internal) + + Data is automatically encoded and decoded as JSON. The callback + function will be called for each inbound message. + """ + def __init__(self, ipc_socket, callback=None, quit_callback=None): + """Create the wrapper. + + *ipc_socket* is the path to the socket. + *callback(json_data)* is the function for recieving events. + *quit_callback* is called when the socket connection dies. + """ + self.ipc_socket = ipc_socket + self.callback = callback + self.quit_callback = quit_callback + self.socket = socket.socket(socket.AF_UNIX) + self.socket.connect(self.ipc_socket) + + if self.callback is None: + self.callback = lambda data: None + + threading.Thread.__init__(self) + + def stop(self, join=True): + """Terminate the thread.""" + if self.socket is not None: + try: + self.socket.shutdown(socket.SHUT_WR) + self.socket.close() + self.socket = None + except OSError: + pass # Ignore socket close failure. + if join: + self.join() + + def send(self, data): + """Send *data* to the socket, encoded as JSON.""" + if self.socket is None: + raise BrokenPipeError("socket is closed") + self.socket.send(json.dumps(data).encode('utf-8') + b'\n') + + def run(self): + """Process socket events. Do not run this directly. Use *start*.""" + data = b'' + while True: + current_data = self.socket.recv(1024) + if current_data == b'': + break + + data += current_data + if data[-1] != 10: + continue + + data = data.decode('utf-8', 'ignore').encode('utf-8') + for item in data.split(b'\n'): + if item == b'': + continue + json_data = json.loads(item) + self.callback(json_data) + data = b'' + if self.quit_callback: + self.quit_callback() + +class MPVProcess: + """ + Manages an MPV process, ensuring the socket or pipe is available. (Internal) + """ + def __init__(self, ipc_socket, mpv_location=None, **kwargs): + """ + Create and start the MPV process. Will block until socket/pipe is available. + + *ipc_socket* is the path to the Unix/Linux socket or name of the Windows pipe. + *mpv_location* is the path to mpv. If left unset it tries the one in the PATH. + + All other arguments are forwarded to MPV as command-line arguments. + """ + if mpv_location is None: + if os.name == 'nt': + mpv_location = "mpv.exe" + else: + mpv_location = "mpv" + + log.debug("Staring MPV from {0}.".format(mpv_location)) + ipc_socket_name = ipc_socket + if os.name == 'nt': + ipc_socket = "\\\\.\\pipe\\" + ipc_socket + + if os.name != 'nt' and os.path.exists(ipc_socket): + os.remove(ipc_socket) + + log.debug("Using IPC socket {0} for MPV.".format(ipc_socket)) + self.ipc_socket = ipc_socket + args = [mpv_location] + self._set_default(kwargs, "idle", True) + self._set_default(kwargs, "input_ipc_server", ipc_socket_name) + self._set_default(kwargs, "input_terminal", False) + self._set_default(kwargs, "terminal", False) + args.extend("--{0}={1}".format(v[0].replace("_", "-"), self._mpv_fmt(v[1])) + for v in kwargs.items()) + self.process = subprocess.Popen(args) + ipc_exists = False + for _ in range(100): # Give MPV 10 seconds to start. + time.sleep(0.1) + self.process.poll() + if os.path.exists(ipc_socket): + ipc_exists = True + log.debug("Found MPV socket.") + break + if self.process.returncode is not None: + log.error("MPV failed with returncode {0}.".format(self.process.returncode)) + break + else: + self.process.terminate() + raise MPVError("MPV start timed out.") + + if not ipc_exists or self.process.returncode is not None: + self.process.terminate() + raise MPVError("MPV not started.") + + def _set_default(self, prop_dict, key, value): + if key not in prop_dict: + prop_dict[key] = value + + def _mpv_fmt(self, data): + if data == True: + return "yes" + elif data == False: + return "no" + else: + return data + + def stop(self): + """Terminate the process.""" + self.process.terminate() + if os.name != 'nt' and os.path.exists(self.ipc_socket): + os.remove(self.ipc_socket) + +class MPVInter: + """ + Low-level interface to MPV. Does NOT manage an mpv process. (Internal) + """ + def __init__(self, ipc_socket, callback=None, quit_callback=None): + """Create the wrapper. + + *ipc_socket* is the path to the Unix/Linux socket or name of the Windows pipe. + *callback(event_name, data)* is the function for recieving events. + *quit_callback* is called when the socket connection to MPV dies. + """ + Socket = UnixSocket + if os.name == 'nt': + Socket = WindowsSocket + + self.callback = callback + self.quit_callback = quit_callback + if self.callback is None: + self.callback = lambda event, data: None + + self.socket = Socket(ipc_socket, self.event_callback, self.quit_callback) + self.socket.start() + self.command_id = 1 + self.rid_lock = threading.Lock() + self.socket_lock = threading.Lock() + self.cid_result = {} + self.cid_wait = {} + + def stop(self, join=True): + """Terminate the underlying connection.""" + self.socket.stop(join) + + def event_callback(self, data): + """Internal callback for recieving events from MPV.""" + if "request_id" in data: + self.cid_result[data["request_id"]] = data + self.cid_wait[data["request_id"]].set() + elif "event" in data: + self.callback(data["event"], data) + + def command(self, command, *args): + """ + Issue a command to MPV. Will block until completed or timeout is reached. + + *command* is the name of the MPV command + + All further arguments are forwarded to the MPV command. + Throws TimeoutError if timeout of 120 seconds is reached. + """ + self.rid_lock.acquire() + command_id = self.command_id + self.command_id += 1 + self.rid_lock.release() + + event = threading.Event() + self.cid_wait[command_id] = event + + command_list = [command] + command_list.extend(args) + try: + self.socket_lock.acquire() + self.socket.send({"command":command_list, "request_id": command_id}) + finally: + self.socket_lock.release() + + has_event = event.wait(timeout=TIMEOUT) + if has_event: + data = self.cid_result[command_id] + del self.cid_result[command_id] + del self.cid_wait[command_id] + if data["error"] != "success": + if data["error"] == "property unavailable": + return None + raise MPVError(data["error"]) + else: + return data.get("data") + else: + raise TimeoutError("No response from MPV.") + +class EventHandler(threading.Thread): + """Event handling thread. (Internal)""" + def __init__(self): + """Create an instance of the thread.""" + self.queue = queue.Queue() + threading.Thread.__init__(self) + + def put_task(self, func, *args): + """ + Put a new task to the thread. + + *func* is the function to call + + All further arguments are forwarded to *func*. + """ + self.queue.put((func, args)) + + def stop(self, join=True): + """Terminate the thread.""" + self.queue.put("quit") + self.join(join) + + def run(self): + """Process socket events. Do not run this directly. Use *start*.""" + while True: + event = self.queue.get() + if event == "quit": + break + try: + event[0](*event[1]) + except Exception: + log.error("EventHandler caught exception from {0}.".format(event), exc_info=1) + +class MPV: + """ + The main MPV interface class. Use this to control MPV. + + This will expose all mpv commands as callable methods and all properties. + You can set properties and call the commands directly. + + Please note that if you are using a really old MPV version, a fallback command + list is used. Not all commands may actually work when this fallback is used. + """ + def __init__(self, start_mpv=True, ipc_socket=None, mpv_location=None, + log_handler=None, loglevel=None, quit_callback=None, **kwargs): + """ + Create the interface to MPV and process instance. + + *start_mpv* will start an MPV process if true. (Default: True) + *ipc_socket* is the path to the Unix/Linux socket or name of Windows pipe. (Default: Random Temp File) + *mpv_location* is the location of MPV for *start_mpv*. (Default: Use MPV in PATH) + *log_handler(level, prefix, text)* is an optional handler for log events. (Default: Disabled) + *loglevel* is the level for log messages. Levels are fatal, error, warn, info, v, debug, trace. (Default: Disabled) + *quit_callback* is called when the socket connection to MPV dies. + + All other arguments are forwarded to MPV as command-line arguments if *start_mpv* is used. + """ + self.properties = {} + self.event_bindings = {} + self.key_bindings = {} + self.property_bindings = {} + self.mpv_process = None + self.mpv_inter = None + self.quit_callback = quit_callback + self.event_handler = EventHandler() + self.event_handler.start() + if ipc_socket is None: + rand_file = "mpv{0}".format(random.randint(0, 2**48)) + if os.name == "nt": + ipc_socket = rand_file + else: + ipc_socket = "/tmp/{0}".format(rand_file) + + if start_mpv: + # Attempt to start MPV 3 times. + for i in range(3): + try: + self.mpv_process = MPVProcess(ipc_socket, mpv_location, **kwargs) + break + except MPVError: + log.warning("MPV start failed.", exc_info=1) + continue + else: + raise MPVError("MPV process retry limit reached.") + + self.mpv_inter = MPVInter(ipc_socket, self._callback, self._quit_callback) + self.properties = set(x.replace("-", "_") for x in self.command("get_property", "property-list")) + try: + command_list = [x["name"] for x in self.command("get_property", "command-list")] + except MPVError: + log.warning("Using fallback command list.") + command_list = FALLBACK_COMMAND_LIST + for command in command_list: + object.__setattr__(self, command.replace("-", "_"), self._get_wrapper(command)) + + self._dir = list(self.properties) + self._dir.extend(object.__dir__(self)) + + self.observer_id = 1 + self.observer_lock = threading.Lock() + self.keybind_id = 1 + self.keybind_lock = threading.Lock() + + if log_handler is not None and loglevel is not None: + self.command("request_log_messages", loglevel) + @self.on_event("log-message") + def log_handler_event(data): + self.event_handler.put_task(log_handler, data["level"], data["prefix"], data["text"].strip()) + + @self.on_event("property-change") + def event_handler(data): + if data.get("id") in self.property_bindings: + self.event_handler.put_task(self.property_bindings[data["id"]], data["name"], data.get("data")) + + @self.on_event("client-message") + def client_message_handler(data): + args = data["args"] + if len(args) == 2 and args[0] == "custom-bind": + self.event_handler.put_task(self.key_bindings[args[1]]) + + def _quit_callback(self): + """ + Internal handler for quit events. + """ + if self.quit_callback: + self.quit_callback() + self.terminate(join=False) + + def bind_event(self, name, callback): + """ + Bind a callback to an MPV event. + + *name* is the MPV event name. + *callback(event_data)* is the function to call. + """ + if name not in self.event_bindings: + self.event_bindings[name] = set() + self.event_bindings[name].add(callback) + + def on_event(self, name): + """ + Decorator to bind a callback to an MPV event. + + @on_event(name) + def my_callback(event_data): + pass + """ + def wrapper(func): + self.bind_event(name, func) + return func + return wrapper + + # Added for compatibility. + def event_callback(self, name): + """An alias for on_event to maintain compatibility with python-mpv.""" + return self.on_event(name) + + def on_key_press(self, name): + """ + Decorator to bind a callback to an MPV keypress event. + + @on_key_press(key_name) + def my_callback(): + pass + """ + def wrapper(func): + self.bind_key_press(name, func) + return func + return wrapper + + def bind_key_press(self, name, callback): + """ + Bind a callback to an MPV keypress event. + + *name* is the key symbol. + *callback()* is the function to call. + """ + self.keybind_lock.acquire() + keybind_id = self.keybind_id + self.keybind_id += 1 + self.keybind_lock.release() + + bind_name = "bind{0}".format(keybind_id) + self.key_bindings["bind{0}".format(keybind_id)] = callback + try: + self.keybind(name, "script-message custom-bind {0}".format(bind_name)) + except MPVError: + self.define_section(bind_name, "{0} script-message custom-bind {1}".format(name, bind_name)) + self.enable_section(bind_name) + + def bind_property_observer(self, name, callback): + """ + Bind a callback to an MPV property change. + + *name* is the property name. + *callback(name, data)* is the function to call. + + Returns a unique observer ID needed to destroy the observer. + """ + self.observer_lock.acquire() + observer_id = self.observer_id + self.observer_id += 1 + self.observer_lock.release() + + self.property_bindings[observer_id] = callback + self.command("observe_property", observer_id, name) + return observer_id + + def unbind_property_observer(self, observer_id): + """ + Remove callback to an MPV property change. + + *observer_id* is the id returned by bind_property_observer. + """ + self.command("unobserve_property", observer_id) + del self.property_bindings[observer_id] + + def property_observer(self, name): + """ + Decorator to bind a callback to an MPV property change. + + @property_observer(property_name) + def my_callback(name, data): + pass + """ + def wrapper(func): + self.bind_property_observer(name, func) + return func + return wrapper + + def wait_for_property(self, name): + """ + Waits for the value of a property to change. + + *name* is the name of the property. + """ + event = threading.Event() + first_event = True + def handler(*_): + nonlocal first_event + if first_event == True: + first_event = False + else: + event.set() + observer_id = self.bind_property_observer(name, handler) + event.wait() + self.unbind_property_observer(observer_id) + + def _get_wrapper(self, name): + def wrapper(*args): + return self.command(name, *args) + return wrapper + + def _callback(self, event, data): + if event in self.event_bindings: + for callback in self.event_bindings[event]: + self.event_handler.put_task(callback, data) + + def play(self, url): + """Play the specified URL. An alias to loadfile().""" + self.loadfile(url) + + def __del__(self): + self.terminate() + + def terminate(self, join=True): + """Terminate the connection to MPV and process (if *start_mpv* is used).""" + if self.mpv_process: + self.mpv_process.stop() + if self.mpv_inter: + self.mpv_inter.stop(join) + self.event_handler.stop(join) + + def command(self, command, *args): + """ + Send a command to MPV. All commands are bound to the class by default, + except JSON IPC specific commands. This may also be useful to retain + compatibility with python-mpv, as it does not bind all of the commands. + + *command* is the command name. + + All further arguments are forwarded to the MPV command. + """ + return self.mpv_inter.command(command, *args) + + def __getattr__(self, name): + if name in self.properties: + return self.command("get_property", name.replace("_", "-")) + return object.__getattribute__(self, name) + + def __setattr__(self, name, value): + if name not in {"properties", "command"} and name in self.properties: + return self.command("set_property", name.replace("_", "-"), value) + return object.__setattr__(self, name, value) + + def __hasattr__(self, name): + if object.__hasattr__(self, name): + return True + else: + try: + getattr(self, name) + return True + except MPVError: + return False + + def __dir__(self): + return self._dir diff --git a/syncplay/players/python_mpv_jsonipc/setup.py b/syncplay/players/python_mpv_jsonipc/setup.py new file mode 100644 index 000000000..50e14f537 --- /dev/null +++ b/syncplay/players/python_mpv_jsonipc/setup.py @@ -0,0 +1,25 @@ +from setuptools import setup +import os + +with open("README.md", "r") as fh: + long_description = fh.read() + +setup( + name='python-mpv-jsonipc', + version='1.1.11', + author="Ian Walton", + author_email="iwalton3@gmail.com", + description="Python API to MPV using JSON IPC", + license='Apache-2.0', + long_description=open('README.md').read(), + long_description_content_type="text/markdown", + url="https://github.com/iwalton3/python-mpv-jsonipc", + py_modules=['python_mpv_jsonipc'], + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', + install_requires=[] +) diff --git a/syncplay/resources/syncplayintf.lua b/syncplay/resources/syncplayintf.lua index 839f4e46f..09add0afd 100644 --- a/syncplay/resources/syncplayintf.lua +++ b/syncplay/resources/syncplayintf.lua @@ -341,6 +341,18 @@ mp.register_script_message('set_syncplayintf_options', function(e) set_syncplayintf_options(e) end) +function state_paused_and_position() + -- bob + local pause_status = tostring(mp.get_property_native("pause")) + local position_status = tostring(mp.get_property_native("time-pos")) + mp.command('print-text ""') + -- mp.command('print-text "true7.6"') +end + +mp.register_script_message('get_paused_and_position', function() + state_paused_and_position() +end) + -- Default options local utils = require 'mp.utils' local options = require 'mp.options' diff --git a/syncplay/resources/third-party-notices.rtf b/syncplay/resources/third-party-notices.rtf index bd2c72250..8aebd9b35 100644 --- a/syncplay/resources/third-party-notices.rtf +++ b/syncplay/resources/third-party-notices.rtf @@ -1,489 +1,463 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\vieww13920\viewh8980\viewkind0 -\deftab529 -\pard\tx529\pardeftab529\pardirnatural\partightenfactor0 - -\f0\fs24 \cf0 \CocoaLigature0 Syncplay relies on the following softwares, in compliance with their licenses. \ -\ - -\b Qt.py -\b0 \ -\ -Copyright (c) 2016 Marcus Ottosson\ -\ -Permission is hereby granted, free of charge, to any person obtaining a copy\ -of this software and associated documentation files (the "Software"), to deal\ -in the Software without restriction, including without limitation the rights\ -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ -copies of the Software, and to permit persons to whom the Software is\ -furnished to do so, subject to the following conditions:\ -\ -The above copyright notice and this permission notice shall be included in all\ -copies or substantial portions of the Software.\ -\ - -\b Qt for Python\ - -\b0 \ -Copyright (C) 2018 The Qt Company Ltd.\ -Contact: https://www.qt.io/licensing/\ -\ -This program is free software: you can redistribute it and/or modify\ -it under the terms of the GNU Lesser General Public License as published\ -by the Free Software Foundation, either version 3 of the License, or\ -(at your option) any later version.\ -\ -This program is distributed in the hope that it will be useful,\ -but WITHOUT ANY WARRANTY; without even the implied warranty of\ -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ -GNU Lesser General Public License for more details.\ -\ -You should have received a copy of the GNU Lesser General Public License\ -along with this program. If not, see .\ -\ - -\b Qt -\b0 \ -\ -This program uses Qt under the GNU LGPL version 3.\ -\ -Qt is a C++ toolkit for cross-platform application development.\ -\ -Qt provides single-source portability across all major desktop operating systems. It is also available for embedded Linux and other embedded and mobile operating systems.\ -\ -Qt is available under three different licensing options designed to accommodate the needs of our various users.\ -\ -Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 3 or GNU LGPL version 2.1.\ -\ -Qt licensed under the GNU LGPL version 3 is appropriate for the development of Qt applications provided you can comply with the terms and conditions of the GNU LGPL version 3.\ -\ -Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications provided you can comply with the terms and conditions of the GNU LGPL version 2.1.\ -\ -Please see qt.io/licensing for an overview of Qt licensing.\ -\ -Copyright (C) 2017 The Qt Company Ltd and other contributors.\ -\ -Qt and the Qt logo are trademarks of The Qt Company Ltd.\ -\ -Qt is The Qt Company Ltd product developed as an open source project. See qt.io for more information.\ -\ - -\b Twisted\ -\ - -\b0 Copyright (c) 2001-2017\ -Allen Short\ -Amber Hawkie Brown\ -Andrew Bennetts\ -Andy Gayton\ -Antoine Pitrou\ -Apple Computer, Inc.\ -Ashwini Oruganti\ -Benjamin Bruheim\ -Bob Ippolito\ -Canonical Limited\ -Christopher Armstrong\ -David Reid\ -Divmod Inc.\ -Donovan Preston\ -Eric Mangold\ -Eyal Lotem\ -Google Inc.\ -Hybrid Logic Ltd.\ -Hynek Schlawack\ -Itamar Turner-Trauring\ -James Knight\ -Jason A. Mobarak\ -Jean-Paul Calderone\ -Jessica McKellar\ -Jonathan D. Simms\ -Jonathan Jacobs\ -Jonathan Lange\ -Julian Berman\ -J\'fcrgen Hermann\ -Kevin Horn\ -Kevin Turner\ -Laurens Van Houtven\ -Mary Gardiner\ -Massachusetts Institute of Technology\ -Matthew Lefkowitz\ -Moshe Zadka\ -Paul Swartz\ -Pavel Pergamenshchik\ -Rackspace, US Inc.\ -Ralph Meijer\ -Richard Wall\ -Sean Riley\ -Software Freedom Conservancy\ -Tavendo GmbH\ -Thijs Triemstra\ -Thomas Herve\ -Timothy Allen\ -Tom Prince\ -Travis B. Hartwell\ -\ -and others that have contributed code to the public domain.\ -\ -Permission is hereby granted, free of charge, to any person obtaining\ -a copy of this software and associated documentation files (the\ -"Software"), to deal in the Software without restriction, including\ -without limitation the rights to use, copy, modify, merge, publish,\ -distribute, sublicense, and/or sell copies of the Software, and to\ -permit persons to whom the Software is furnished to do so, subject to\ -the following conditions:\ -\ -The above copyright notice and this permission notice shall be\ -included in all copies or substantial portions of the Software.\ - -\b \ -qt5reactor\ -\ - -\b0 Copyright (c) 2001-2018\ -Allen Short\ -Andy Gayton\ -Andrew Bennetts\ -Antoine Pitrou\ -Apple Computer, Inc.\ -Ashwini Oruganti\ -bakbuk\ -Benjamin Bruheim\ -Bob Ippolito\ -Burak Nehbit\ -Canonical Limited\ -Christopher Armstrong\ -Christopher R. Wood\ -David Reid\ -Donovan Preston\ -Elvis Stansvik\ -Eric Mangold\ -Eyal Lotem\ -Glenn Tarbox\ -Google Inc.\ -Hybrid Logic Ltd.\ -Hynek Schlawack\ -Itamar Turner-Trauring\ -James Knight\ -Jason A. Mobarak\ -Jean-Paul Calderone\ -Jessica McKellar\ -Jonathan Jacobs\ -Jonathan Lange\ -Jonathan D. Simms\ -J\'fcrgen Hermann\ -Julian Berman\ -Kevin Horn\ -Kevin Turner\ -Kyle Altendorf\ -Laurens Van Houtven\ -Mary Gardiner\ -Matthew Lefkowitz\ -Massachusetts Institute of Technology\ -Moshe Zadka\ -Paul Swartz\ -Pavel Pergamenshchik\ -Ralph Meijer\ -Richard Wall\ -Sean Riley\ -Software Freedom Conservancy\ -Tarashish Mishra\ -Travis B. Hartwell\ -Thijs Triemstra\ -Thomas Herve\ -Timothy Allen\ -Tom Prince\ -\ -Permission is hereby granted, free of charge, to any person obtaining\ -a copy of this software and associated documentation files (the\ -"Software"), to deal in the Software without restriction, including\ -without limitation the rights to use, copy, modify, merge, publish,\ -distribute, sublicense, and/or sell copies of the Software, and to\ -permit persons to whom the Software is furnished to do so, subject to\ -the following conditions:\ -\ -The above copyright notice and this permission notice shall be\ -included in all copies or substantial portions of the Software.\ -\ -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\ -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\ -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\ -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\ -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\ -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\ -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -\b \ -\ -appnope\ - -\b0 \ -Copyright (c) 2013, Min Ragan-Kelley\ -\ -All rights reserved.\ -\ -Redistribution and use in source and binary forms, with or without\ -modification, are permitted provided that the following conditions are met:\ -\ -Redistributions of source code must retain the above copyright notice, this\ -list of conditions and the following disclaimer.\ -\ -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\ -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\ -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\ -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\ -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\ -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\ -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\ -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\ -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\ -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ -\ - -\b py2exe\ - -\b0 \ -Copyright (c) 2000-2013 Thomas Heller, Jimmy Retzlaff\ -\ -Permission is hereby granted, free of charge, to any person obtaining\ -a copy of this software and associated documentation files (the\ -"Software"), to deal in the Software without restriction, including\ -without limitation the rights to use, copy, modify, merge, publish,\ -distribute, sublicense, and/or sell copies of the Software, and to\ -permit persons to whom the Software is furnished to do so, subject to\ -the following conditions:\ -\ -The above copyright notice and this permission notice shall be\ -included in all copies or substantial portions of the Software.\ -\ - -\b py2app\ -\ - -\b0 Copyright (c) 2004 Bob Ippolito.\ -\ -Some parts copyright (c) 2010-2014 Ronald Oussoren\ -\ -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\ -\ -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\ -\ - -\b dmgbuild\ -\ - -\b0 Copyright (c) 2014 Alastair Houghton\ -Copyright (c) 2017 The Qt Company Ltd.\ -\ -Permission is hereby granted, free of charge, to any person obtaining a copy\ -of this software and associated documentation files (the "Software"), to deal\ -in the Software without restriction, including without limitation the rights\ -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ -copies of the Software, and to permit persons to whom the Software is\ -furnished to do so, subject to the following conditions:\ -\ -The above copyright notice and this permission notice shall be included in\ -all copies or substantial portions of the Software.\ -\ - -\b Requests\ -\ - -\b0 Copyright 2018 Kenneth Reitz\ -\ -Licensed under the Apache License, Version 2.0 (the \'93License\'94); you may not use this file\ -except in compliance with the License. You may obtain a copy of the License at\ -\ -http://www.apache.org/licenses/LICENSE-2.0\ -\ -Unless required by applicable law or agreed to in writing, software distributed under the \ -License is distributed on an \'93AS IS\'94 BASIS, WITHOUT WARRANTIES OR CONDI-\ -TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\ -uage governing permissions and limitations under the License.\ -\ - -\b mpv-repl -\b0 \ -\ -Copyright 2016, James Ross-Gowan\ -\ -Permission to use, copy, modify, and/or distribute this software for any\ -purpose with or without fee is hereby granted, provided that the above\ -copyright notice and this permission notice appear in all copies.\ -\ -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\ -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\ -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\ -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\ -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\ -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\ -PERFORMANCE OF THIS SOFTWARE.\ -\ - -\b python-certifi -\b0 \ -\ -This Source Code Form is subject to the terms of the Mozilla Public License,\ -v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain\ -one at http://mozilla.org/MPL/2.0/.\ -\ - -\b cffi -\b0 \ -\ -\pard\pardeftab720\partightenfactor0 -\cf0 This package has been mostly done by Armin Rigo with help from\ -Maciej Fija\uc0\u322 kowski. The idea is heavily based (although not directly\ -copied) from LuaJIT ffi by Mike Pall.\ -\ -Other contributors:\ -\ - Google Inc.\ -\pard\tx529\pardeftab529\pardirnatural\partightenfactor0 -\cf0 \ -The MIT License\ -\ -Permission is hereby granted, free of charge, to any person \ -obtaining a copy of this software and associated documentation \ -files (the "Software"), to deal in the Software without \ -restriction, including without limitation the rights to use, \ -copy, modify, merge, publish, distribute, sublicense, and/or \ -sell copies of the Software, and to permit persons to whom the \ -Software is furnished to do so, subject to the following conditions:\ -\ -The above copyright notice and this permission notice shall be included \ -in all copies or substantial portions of the Software.\ -\ -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS \ -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \ -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \ -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \ -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \ -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \ -DEALINGS IN THE SOFTWARE.\ -\ - -\b service-identity -\b0 \ -\ -Copyright (c) 2014 Hynek Schlawack\ -\ -Permission is hereby granted, free of charge, to any person obtaining a copy of\ -this software and associated documentation files (the "Software"), to deal in\ -the Software without restriction, including without limitation the rights to\ -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\ -of the Software, and to permit persons to whom the Software is furnished to do\ -so, subject to the following conditions:\ -\ -The above copyright notice and this permission notice shall be included in all\ -copies or substantial portions of the Software.\ -\ -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\ -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\ -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\ -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\ -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\ -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\ -SOFTWARE.\ -\ - -\b pyopenssl -\b0 \ -\ -Licensed under the Apache License, Version 2.0 (the \'93License\'94); you may not use this file\ -except in compliance with the License. You may obtain a copy of the License at\ -\ -http://www.apache.org/licenses/LICENSE-2.0\ -\ -Unless required by applicable law or agreed to in writing, software distributed under the \ -License is distributed on an \'93AS IS\'94 BASIS, WITHOUT WARRANTIES OR CONDI-\ -TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\ -uage governing permissions and limitations under the License.\ -\ - -\b cryptography -\b0 \ -\ -Authors listed here: https://github.com/pyca/cryptography/blob/master/AUTHORS.rst\ -\ -Licensed under the Apache License, Version 2.0 (the \'93License\'94); you may not use this file\ -except in compliance with the License. You may obtain a copy of the License at\ -\ -http://www.apache.org/licenses/LICENSE-2.0\ -\ -Unless required by applicable law or agreed to in writing, software distributed under the \ -License is distributed on an \'93AS IS\'94 BASIS, WITHOUT WARRANTIES OR CONDI-\ -TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\ -uage governing permissions and limitations under the License.\ -\ - -\b Darkdetect -\b0 \ -\ -Copyright (c) 2019, Alberto Sottile\ -All rights reserved.\ -\ -Redistribution and use in source and binary forms, with or without\ -modification, are permitted provided that the following conditions are met:\ - * Redistributions of source code must retain the above copyright\ - notice, this list of conditions and the following disclaimer.\ - * Redistributions in binary form must reproduce the above copyright\ - notice, this list of conditions and the following disclaimer in the\ - documentation and/or other materials provided with the distribution.\ - * Neither the name of "darkdetect" nor the\ - names of its contributors may be used to endorse or promote products\ - derived from this software without specific prior written permission.\ -\ -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\ -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\ -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\ -DISCLAIMED. IN NO EVENT SHALL "Alberto Sottile" BE LIABLE FOR ANY\ -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\ -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\ -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\ -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\ -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\ -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ -\ - -\b Icons\ -\ - -\b0 Syncplay uses the following icons and images:\ -\ -- Silk icon set 1.3\ -_________________________________________\ -Mark James\ -http://www.famfamfam.com/lab/icons/silk/\ -_________________________________________\ -\ -This work is licensed under a\ -Creative Commons Attribution 2.5 License.\ -[ http://creativecommons.org/licenses/by/2.5/ ]\ -\ -This means you may use it for any purpose,\ -and make any changes you like.\ -All I ask is that you include a link back\ -to this page in your credits.\ -\ -Are you using this icon set? Send me an email\ -(including a link or picture if available) to\ -mjames@gmail.com\ -\ -Any other questions about this icon set please\ -contact mjames@gmail.com\ -\ -- Silk Companion 1\ -\ -\pard\pardeftab720\partightenfactor0 -\cf0 Copyright Damien Guard - CC-BY 3.0\ -https://damieng.com/creative/icons/silk-companion-1-icons\ -\ -- Padlock free icon\ -CC-BY 3.0\ -Icon made by Maxim Basinski from https://www.flaticon.com/free-icon/padlock_291248\ -\ -\pard\tx529\pardeftab529\pardirnatural\partightenfactor0 -\cf0 \ -} \ No newline at end of file +{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deftab529{\fonttbl{\f0\fswiss\fcharset0 Helvetica;}{\f1\fswiss\fcharset238 Helvetica;}} +{\colortbl ;\red0\green0\blue255;} +{\*\generator Riched20 10.0.18362}\viewkind4\uc1 +\pard\tx529\f0\fs24\lang9 Syncplay relies on the following softwares, in compliance with their licenses. \par +\par +\b Qt.py\b0\par +\par +Copyright (c) 2016 Marcus Ottosson\par +\par +Permission is hereby granted, free of charge, to any person obtaining a copy\par +of this software and associated documentation files (the "Software"), to deal\par +in the Software without restriction, including without limitation the rights\par +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\par +copies of the Software, and to permit persons to whom the Software is\par +furnished to do so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included in all\par +copies or substantial portions of the Software.\par +\par +\b Qt for Python\par +\b0\par +Copyright (C) 2018 The Qt Company Ltd.\par +Contact: {{\field{\*\fldinst{HYPERLINK https://www.qt.io/licensing/ }}{\fldrslt{https://www.qt.io/licensing/\ul0\cf0}}}}\f0\fs24\par +\par +This program is free software: you can redistribute it and/or modify\par +it under the terms of the GNU Lesser General Public License as published\par +by the Free Software Foundation, either version 3 of the License, or\par +(at your option) any later version.\par +\par +This program is distributed in the hope that it will be useful,\par +but WITHOUT ANY WARRANTY; without even the implied warranty of\par +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\par +GNU Lesser General Public License for more details.\par +\par +You should have received a copy of the GNU Lesser General Public License\par +along with this program. If not, see <{{\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/"}}{\fldrslt{http://www.gnu.org/licenses/\ul0\cf0}}}}\f0\fs24 >.\par +\par +\b Qt\b0\par +\par +This program uses Qt under the GNU LGPL version 3.\par +\par +Qt is a C++ toolkit for cross-platform application development.\par +\par +Qt provides single-source portability across all major desktop operating systems. It is also available for embedded Linux and other embedded and mobile operating systems.\par +\par +Qt is available under three different licensing options designed to accommodate the needs of our various users.\par +\par +Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 3 or GNU LGPL version 2.1.\par +\par +Qt licensed under the GNU LGPL version 3 is appropriate for the development of Qt applications provided you can comply with the terms and conditions of the GNU LGPL version 3.\par +\par +Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications provided you can comply with the terms and conditions of the GNU LGPL version 2.1.\par +\par +Please see qt.io/licensing for an overview of Qt licensing.\par +\par +Copyright (C) 2017 The Qt Company Ltd and other contributors.\par +\par +Qt and the Qt logo are trademarks of The Qt Company Ltd.\par +\par +Qt is The Qt Company Ltd product developed as an open source project. See qt.io for more information.\par +\par +\b Twisted\par +\par +\b0 Copyright (c) 2001-2017\par +Allen Short\par +Amber Hawkie Brown\par +Andrew Bennetts\par +Andy Gayton\par +Antoine Pitrou\par +Apple Computer, Inc.\par +Ashwini Oruganti\par +Benjamin Bruheim\par +Bob Ippolito\par +Canonical Limited\par +Christopher Armstrong\par +David Reid\par +Divmod Inc.\par +Donovan Preston\par +Eric Mangold\par +Eyal Lotem\par +Google Inc.\par +Hybrid Logic Ltd.\par +Hynek Schlawack\par +Itamar Turner-Trauring\par +James Knight\par +Jason A. Mobarak\par +Jean-Paul Calderone\par +Jessica McKellar\par +Jonathan D. Simms\par +Jonathan Jacobs\par +Jonathan Lange\par +Julian Berman\par +J\'fcrgen Hermann\par +Kevin Horn\par +Kevin Turner\par +Laurens Van Houtven\par +Mary Gardiner\par +Massachusetts Institute of Technology\par +Matthew Lefkowitz\par +Moshe Zadka\par +Paul Swartz\par +Pavel Pergamenshchik\par +Rackspace, US Inc.\par +Ralph Meijer\par +Richard Wall\par +Sean Riley\par +Software Freedom Conservancy\par +Tavendo GmbH\par +Thijs Triemstra\par +Thomas Herve\par +Timothy Allen\par +Tom Prince\par +Travis B. Hartwell\par +\par +and others that have contributed code to the public domain.\par +\par +Permission is hereby granted, free of charge, to any person obtaining\par +a copy of this software and associated documentation files (the\par +"Software"), to deal in the Software without restriction, including\par +without limitation the rights to use, copy, modify, merge, publish,\par +distribute, sublicense, and/or sell copies of the Software, and to\par +permit persons to whom the Software is furnished to do so, subject to\par +the following conditions:\par +\par +The above copyright notice and this permission notice shall be\par +included in all copies or substantial portions of the Software.\par +\b\par +qt5reactor\par +\par +\b0 Copyright (c) 2001-2018\par +Allen Short\par +Andy Gayton\par +Andrew Bennetts\par +Antoine Pitrou\par +Apple Computer, Inc.\par +Ashwini Oruganti\par +bakbuk\par +Benjamin Bruheim\par +Bob Ippolito\par +Burak Nehbit\par +Canonical Limited\par +Christopher Armstrong\par +Christopher R. Wood\par +David Reid\par +Donovan Preston\par +Elvis Stansvik\par +Eric Mangold\par +Eyal Lotem\par +Glenn Tarbox\par +Google Inc.\par +Hybrid Logic Ltd.\par +Hynek Schlawack\par +Itamar Turner-Trauring\par +James Knight\par +Jason A. Mobarak\par +Jean-Paul Calderone\par +Jessica McKellar\par +Jonathan Jacobs\par +Jonathan Lange\par +Jonathan D. Simms\par +J\'fcrgen Hermann\par +Julian Berman\par +Kevin Horn\par +Kevin Turner\par +Kyle Altendorf\par +Laurens Van Houtven\par +Mary Gardiner\par +Matthew Lefkowitz\par +Massachusetts Institute of Technology\par +Moshe Zadka\par +Paul Swartz\par +Pavel Pergamenshchik\par +Ralph Meijer\par +Richard Wall\par +Sean Riley\par +Software Freedom Conservancy\par +Tarashish Mishra\par +Travis B. Hartwell\par +Thijs Triemstra\par +Thomas Herve\par +Timothy Allen\par +Tom Prince\par +\par +Permission is hereby granted, free of charge, to any person obtaining\par +a copy of this software and associated documentation files (the\par +"Software"), to deal in the Software without restriction, including\par +without limitation the rights to use, copy, modify, merge, publish,\par +distribute, sublicense, and/or sell copies of the Software, and to\par +permit persons to whom the Software is furnished to do so, subject to\par +the following conditions:\par +\par +The above copyright notice and this permission notice shall be\par +included in all copies or substantial portions of the Software.\par +\par +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\par +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\par +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\par +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\par +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\par +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\par +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\b\par +\par +appnope\par +\b0\par +Copyright (c) 2013, Min Ragan-Kelley\par +\par +All rights reserved.\par +\par +Redistribution and use in source and binary forms, with or without\par +modification, are permitted provided that the following conditions are met:\par +\par +Redistributions of source code must retain the above copyright notice, this\par +list of conditions and the following disclaimer.\par +\par +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\par +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\par +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\par +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\par +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\par +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\par +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\par +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\par +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\par +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\par +\par +\b py2exe\par +\b0\par +Copyright (c) 2000-2013 Thomas Heller, Jimmy Retzlaff\par +\par +Permission is hereby granted, free of charge, to any person obtaining\par +a copy of this software and associated documentation files (the\par +"Software"), to deal in the Software without restriction, including\par +without limitation the rights to use, copy, modify, merge, publish,\par +distribute, sublicense, and/or sell copies of the Software, and to\par +permit persons to whom the Software is furnished to do so, subject to\par +the following conditions:\par +\par +The above copyright notice and this permission notice shall be\par +included in all copies or substantial portions of the Software.\par +\par +\b py2app\par +\par +\b0 Copyright (c) 2004 Bob Ippolito.\par +\par +Some parts copyright (c) 2010-2014 Ronald Oussoren\par +\par +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par +\par +\b dmgbuild\par +\par +\b0 Copyright (c) 2014 Alastair Houghton\par +Copyright (c) 2017 The Qt Company Ltd.\par +\par +Permission is hereby granted, free of charge, to any person obtaining a copy\par +of this software and associated documentation files (the "Software"), to deal\par +in the Software without restriction, including without limitation the rights\par +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\par +copies of the Software, and to permit persons to whom the Software is\par +furnished to do so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included in\par +all copies or substantial portions of the Software.\par +\par +\b Requests\par +\par +\b0 Copyright 2018 Kenneth Reitz\par +\par +Licensed under the Apache License, Version 2.0 (the \ldblquote License\rdblquote ); you may not use this file\par +except in compliance with the License. You may obtain a copy of the License at\par +\par +{{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f0\fs24\par +\par +Unless required by applicable law or agreed to in writing, software distributed under the \par +License is distributed on an \ldblquote AS IS\rdblquote BASIS, WITHOUT WARRANTIES OR CONDI-\par +TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\par +uage governing permissions and limitations under the License.\par +\par +\b mpv-repl\b0\par +\par +Copyright 2016, James Ross-Gowan\par +\par +Permission to use, copy, modify, and/or distribute this software for any\par +purpose with or without fee is hereby granted, provided that the above\par +copyright notice and this permission notice appear in all copies.\par +\par +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\par +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\par +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\par +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\par +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\par +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\par +PERFORMANCE OF THIS SOFTWARE.\par +\par +\b python-certifi\b0\par +\par +This Source Code Form is subject to the terms of the Mozilla Public License,\par +v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain\par +one at {{\field{\*\fldinst{HYPERLINK http://mozilla.org/MPL/2.0/ }}{\fldrslt{http://mozilla.org/MPL/2.0/\ul0\cf0}}}}\f0\fs24 .\par +\par +\b cffi\b0\par +\par + +\pard This package has been mostly done by Armin Rigo with help from\par +Maciej Fija\f1\'b3kowski. The idea is heavily based (although not directly\par +copied) from LuaJIT ffi by Mike Pall.\par +\par +Other contributors:\par +\par + Google Inc.\par + +\pard\tx529\par +The MIT License\par +\par +Permission is hereby granted, free of charge, to any person \par +obtaining a copy of this software and associated documentation \par +files (the "Software"), to deal in the Software without \par +restriction, including without limitation the rights to use, \par +copy, modify, merge, publish, distribute, sublicense, and/or \par +sell copies of the Software, and to permit persons to whom the \par +Software is furnished to do so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included \par +in all copies or substantial portions of the Software.\par +\par +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS \par +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \par +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \par +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \par +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \par +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \par +DEALINGS IN THE SOFTWARE.\par +\par +\b service-identity\b0\par +\par +Copyright (c) 2014 Hynek Schlawack\par +\par +Permission is hereby granted, free of charge, to any person obtaining a copy of\par +this software and associated documentation files (the "Software"), to deal in\par +the Software without restriction, including without limitation the rights to\par +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\par +of the Software, and to permit persons to whom the Software is furnished to do\par +so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included in all\par +copies or substantial portions of the Software.\par +\par +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\par +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\par +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\par +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\par +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\par +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\par +SOFTWARE.\par +\par +\b pyopenssl\b0\par +\par +Licensed under the Apache License, Version 2.0 (the \ldblquote License\rdblquote ); you may not use this file\par +except in compliance with the License. You may obtain a copy of the License at\par +\par +{{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f1\fs24\par +\par +Unless required by applicable law or agreed to in writing, software distributed under the \par +License is distributed on an \ldblquote AS IS\rdblquote BASIS, WITHOUT WARRANTIES OR CONDI-\par +TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\par +uage governing permissions and limitations under the License.\par +\par +\b cryptography\b0\par +\par +Authors listed here: {{\field{\*\fldinst{HYPERLINK https://github.com/pyca/cryptography/blob/master/AUTHORS.rst }}{\fldrslt{https://github.com/pyca/cryptography/blob/master/AUTHORS.rst\ul0\cf0}}}}\f1\fs24\par +\par +Licensed under the Apache License, Version 2.0 (the \ldblquote License\rdblquote ); you may not use this file\par +except in compliance with the License. You may obtain a copy of the License at\par +\par +{{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f1\fs24\par +\par +Unless required by applicable law or agreed to in writing, software distributed under the \par +License is distributed on an \ldblquote AS IS\rdblquote BASIS, WITHOUT WARRANTIES OR CONDI-\par +TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\par +uage governing permissions and limitations under the License.\par +\par +\b Darkdetect\b0\par +\par +Copyright (c) 2019, Alberto Sottile\par +All rights reserved.\par +\par +Redistribution and use in source and binary forms, with or without\par +modification, are permitted provided that the following conditions are met:\par + * Redistributions of source code must retain the above copyright\par + notice, this list of conditions and the following disclaimer.\par + * Redistributions in binary form must reproduce the above copyright\par + notice, this list of conditions and the following disclaimer in the\par + documentation and/or other materials provided with the distribution.\par + * Neither the name of "darkdetect" nor the\par + names of its contributors may be used to endorse or promote products\par + derived from this software without specific prior written permission.\par +\par +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\par +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\par +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\par +DISCLAIMED. IN NO EVENT SHALL "Alberto Sottile" BE LIABLE FOR ANY\par +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\par +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\par +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\par +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\par +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\par +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\par +\par +\b Python MPV JSONIPC\par +\b0\f0\lang2057 Authors listed here: {{\field{\*\fldinst{HYPERLINK https://github.com/iwalton3/python-mpv-jsonipc/ }}{\fldrslt{https://github.com/iwalton3/python-mpv-jsonipc/\ul0\cf0}}}}\f0\fs24 (principal developer Ian Walton / iwalton3)\b\f1\lang9\par +\par +\b0 Licensed under the Apache License, Version 2.0 (the \ldblquote License\rdblquote ); you may not use this file\par +except in compliance with the License. You may obtain a copy of the License at\par +\par +{{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f1\fs24\par +\par +Unless required by applicable law or agreed to in writing, software distributed under the \par +License is distributed on an \ldblquote AS IS\rdblquote BASIS, WITHOUT WARRANTIES OR CONDI-\par +TIONS OF ANY KIND, either express or implied. See the License for the specific lang-\par +uage governing permissions and limitations under the License.\par +\b\par +\par +Icons\par +\par +\b0 Syncplay uses the following icons and images:\par +\par +- Silk icon set 1.3\par +_________________________________________\par +Mark James\par +{{\field{\*\fldinst{HYPERLINK http://www.famfamfam.com/lab/icons/silk/ }}{\fldrslt{http://www.famfamfam.com/lab/icons/silk/\ul0\cf0}}}}\f1\fs24\par +_________________________________________\par +\par +This work is licensed under a\par +Creative Commons Attribution 2.5 License.\par +[ {{\field{\*\fldinst{HYPERLINK http://creativecommons.org/licenses/by/2.5/ }}{\fldrslt{http://creativecommons.org/licenses/by/2.5/\ul0\cf0}}}}\f1\fs24 ]\par +\par +This means you may use it for any purpose,\par +and make any changes you like.\par +All I ask is that you include a link back\par +to this page in your credits.\par +\par +Are you using this icon set? Send me an email\par +(including a link or picture if available) to\par +mjames@gmail.com\par +\par +Any other questions about this icon set please\par +contact mjames@gmail.com\par +\par +- Silk Companion 1\par +\par + +\pard Copyright Damien Guard - CC-BY 3.0\par +{{\field{\*\fldinst{HYPERLINK https://damieng.com/creative/icons/silk-companion-1-icons }}{\fldrslt{https://damieng.com/creative/icons/silk-companion-1-icons\ul0\cf0}}}}\f1\fs24\par +\par +- Padlock free icon\par +CC-BY 3.0\par +Icon made by Maxim Basinski from {{\field{\*\fldinst{HYPERLINK https://www.flaticon.com/free-icon/padlock_291248 }}{\fldrslt{https://www.flaticon.com/free-icon/padlock_291248\ul0\cf0}}}}\f1\fs24\par +\par + +\pard\tx529\par +} + \ No newline at end of file