コード例 #1
0
    def _tryToFillPlayerPath(self, playerpath, playerpathlist):
        settings = QSettings("Syncplay", "PlayerList")
        settings.beginGroup("PlayerList")
        savedPlayers = settings.value("PlayerList", [])
        if(not isinstance(savedPlayers, list)):
            savedPlayers = []
        playerpathlist = list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist + savedPlayers)))
        settings.endGroup()
        foundpath = ""

        if playerpath != None and playerpath != "":
            if not os.path.isfile(playerpath):
                expandedpath = PlayerFactory().getExpandedPlayerPathByPath(playerpath)
                if expandedpath != None and os.path.isfile(expandedpath):
                    playerpath = expandedpath

            if os.path.isfile(playerpath):
                foundpath = playerpath
                self.executablepathCombobox.addItem(foundpath)

        for path in playerpathlist:
            if(os.path.isfile(path) and os.path.normcase(os.path.normpath(path)) != os.path.normcase(os.path.normpath(foundpath))):
                self.executablepathCombobox.addItem(path)
                if foundpath == "":
                    foundpath = path

        if foundpath != "":
            settings.beginGroup("PlayerList")
            playerpathlist.append(os.path.normcase(os.path.normpath(foundpath)))
            settings.setValue("PlayerList",  list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
            settings.endGroup()
        return(foundpath)
コード例 #2
0
 def updateExecutableIcon(self):
     currentplayerpath = unicode(self.executablepathCombobox.currentText())
     iconpath = PlayerFactory().getPlayerIconByPath(currentplayerpath)
     if iconpath != None and iconpath != "":
         self.executableiconImage.load(self.resourcespath + iconpath)
         self.executableiconLabel.setPixmap(QtGui.QPixmap.fromImage(self.executableiconImage))
     else:
         self.executableiconLabel.setPixmap(QtGui.QPixmap.fromImage(QtGui.QImage()))
コード例 #3
0
    def __init__(self):
        self._config = {
            "host": None,
            "port": constants.DEFAULT_PORT,
            "name": None,
            "debug": False,
            "forceGuiPrompt": True,
            "noGui": False,
            "noStore": False,
            "room": "",
            "password": None,
            "playerPath": None,
            "perPlayerArguments": None,
            "mediaSearchDirectories": None,
            "sharedPlaylistEnabled": True,
            "loopAtEndOfPlaylist": False,
            "loopSingleFiles": False,
            "onlySwitchToTrustedDomains": True,
            "trustedDomains": constants.DEFAULT_TRUSTED_DOMAINS,
            "file": None,
            "playerArgs": [],
            "playerClass": None,
            "slowdownThreshold": constants.DEFAULT_SLOWDOWN_KICKIN_THRESHOLD,
            "rewindThreshold": constants.DEFAULT_REWIND_THRESHOLD,
            "fastforwardThreshold": constants.DEFAULT_FASTFORWARD_THRESHOLD,
            "rewindOnDesync": True,
            "slowOnDesync": True,
            "fastforwardOnDesync": True,
            "dontSlowDownWithMe": False,
            "filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "pauseOnLeave": False,
            "readyAtStart": False,
            "unpauseAction": constants.UNPAUSE_IFOTHERSREADY_MODE,
            "autoplayInitialState": None,
            "autoplayMinUsers": -1,
            "autoplayRequireSameFilenames": True,
            "clearGUIData": False,
            "language": "",
            "checkForUpdatesAutomatically": None,
            "lastCheckedForUpdates": "",
            "resetConfig": False,
            "showOSD": True,
            "showOSDWarnings": True,
            "showSlowdownOSD": True,
            "showDifferentRoomOSD": False,
            "showSameRoomOSD": True,
            "showNonControllerOSD": False,
            "showContactInfo": True,
            "showDurationNotification": True,
            "chatInputEnabled": True,
            "chatInputFontFamily": 'sans-serif',
            "chatInputRelativeFontSize": constants.DEFAULT_CHAT_FONT_SIZE,
            "chatInputFontWeight": constants.DEFAULT_CHAT_FONT_WEIGHT,
            "chatInputFontUnderline": False,
            "chatInputFontColor": constants.DEFAULT_CHAT_INPUT_FONT_COLOR,
            "chatInputPosition": constants.INPUT_POSITION_TOP,
            "chatDirectInput": False,
            "chatOutputEnabled": True,
            "chatOutputFontFamily": 'sans-serif',
            "chatOutputRelativeFontSize": constants.DEFAULT_CHAT_FONT_SIZE,
            "chatOutputFontWeight": constants.DEFAULT_CHAT_FONT_WEIGHT,
            "chatOutputFontUnderline": False,
            "chatOutputMode": constants.CHATROOM_MODE,
            "chatMaxLines": 7,
            "chatTopMargin": 25,
            "chatLeftMargin": 20,
            "chatBottomMargin": 30,
            "chatMoveOSD": True,
            "chatOSDMargin": 110,
            "notificationTimeout": 3,
            "alertTimeout": 5,
            "chatTimeout": 7,
            "publicServers": []
        }

        self._defaultConfig = self._config.copy()

        #
        # Custom validation in self._validateArguments
        #
        self._required = [
            "host",
            "port",
            "room",
            "playerPath",
            "playerClass",
        ]

        self._boolean = [
            "debug", "forceGuiPrompt", "noGui", "noStore",
            "dontSlowDownWithMe", "pauseOnLeave", "readyAtStart",
            "autoplayRequireSameFilenames", "clearGUIData", "rewindOnDesync",
            "slowOnDesync", "fastforwardOnDesync", "pauseOnLeave",
            "clearGUIData", "resetConfig", "showOSD", "showOSDWarnings",
            "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD",
            "showNonControllerOSD", "showDurationNotification",
            "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles",
            "onlySwitchToTrustedDomains", "chatInputEnabled",
            "chatInputFontUnderline", "chatDirectInput", "chatMoveOSD",
            "chatOutputEnabled", "chatOutputFontUnderline"
        ]
        self._tristate = [
            "checkForUpdatesAutomatically",
            "autoplayInitialState",
        ]

        self._serialised = [
            "perPlayerArguments",
            "mediaSearchDirectories",
            "trustedDomains",
            "publicServers",
        ]

        self._numeric = [
            "slowdownThreshold", "rewindThreshold", "fastforwardThreshold",
            "autoplayMinUsers", "chatInputRelativeFontSize",
            "chatInputFontWeight", "chatOutputFontWeight",
            "chatOutputRelativeFontSize", "chatMaxLines", "chatTopMargin",
            "chatLeftMargin", "chatBottomMargin", "chatOSDMargin",
            "notificationTimeout", "alertTimeout", "chatTimeout"
        ]

        self._hexadecimal = ["chatInputFontColor"]

        self._iniStructure = {
            "server_data": ["host", "port", "password"],
            "client_settings": [
                "name", "room", "playerPath", "perPlayerArguments",
                "slowdownThreshold", "rewindThreshold", "fastforwardThreshold",
                "slowOnDesync", "rewindOnDesync", "fastforwardOnDesync",
                "dontSlowDownWithMe", "forceGuiPrompt", "filenamePrivacyMode",
                "filesizePrivacyMode", "unpauseAction", "pauseOnLeave",
                "readyAtStart", "autoplayMinUsers", "autoplayInitialState",
                "mediaSearchDirectories", "sharedPlaylistEnabled",
                "loopAtEndOfPlaylist", "loopSingleFiles",
                "onlySwitchToTrustedDomains", "trustedDomains", "publicServers"
            ],
            "gui": [
                "showOSD", "showOSDWarnings", "showSlowdownOSD",
                "showDifferentRoomOSD", "showSameRoomOSD",
                "showNonControllerOSD", "showDurationNotification",
                "chatInputEnabled", "chatInputFontUnderline",
                "chatInputFontFamily", "chatInputRelativeFontSize",
                "chatInputFontWeight", "chatInputFontColor",
                "chatInputPosition", "chatDirectInput", "chatOutputFontFamily",
                "chatOutputRelativeFontSize", "chatOutputFontWeight",
                "chatOutputFontUnderline", "chatOutputMode", "chatMaxLines",
                "chatTopMargin", "chatLeftMargin", "chatBottomMargin",
                "chatDirectInput", "chatMoveOSD", "chatOSDMargin",
                "notificationTimeout", "alertTimeout", "chatTimeout",
                "chatOutputEnabled"
            ],
            "general": [
                "language", "checkForUpdatesAutomatically",
                "lastCheckedForUpdates"
            ]
        }

        self._playerFactory = PlayerFactory()
コード例 #4
0
    def __init__(self):
        self._config = {
            "host": None,
            "port": constants.DEFAULT_PORT,
            "name": None,
            "debug": False,
            "forceGuiPrompt": True,
            "noGui": False,
            "noStore": False,
            "room": "",
            "password": None,
            "playerPath": None,
            "perPlayerArguments": None,
            "mediaSearchDirectories": None,
            "sharedPlaylistEnabled": True,
            "loopAtEndOfPlaylist": False,
            "loopSingleFiles": False,
            "onlySwitchToTrustedDomains": True,
            "trustedDomains": constants.DEFAULT_TRUSTED_DOMAINS,
            "file": None,
            "playerArgs": [],
            "playerClass": None,
            "slowdownThreshold": constants.DEFAULT_SLOWDOWN_KICKIN_THRESHOLD,
            "rewindThreshold": constants.DEFAULT_REWIND_THRESHOLD,
            "fastforwardThreshold": constants.DEFAULT_FASTFORWARD_THRESHOLD,
            "rewindOnDesync": True,
            "slowOnDesync": True,
            "fastforwardOnDesync": True,
            "dontSlowDownWithMe": False,
            "filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "pauseOnLeave": False,
            "readyAtStart": False,
            "unpauseAction": constants.UNPAUSE_IFOTHERSREADY_MODE,
            "autoplayInitialState": None,
            "autoplayMinUsers": -1,
            "autoplayRequireSameFilenames": True,
            "clearGUIData": False,
            "language": "",
            "checkForUpdatesAutomatically": None,
            "lastCheckedForUpdates": "",
            "resetConfig": False,
            "showOSD": True,
            "showOSDWarnings": True,
            "showSlowdownOSD": True,
            "showDifferentRoomOSD": False,
            "showSameRoomOSD": True,
            "showNonControllerOSD": False,
            "showContactInfo": True,
            "showDurationNotification": True
        }

        self._defaultConfig = self._config.copy()

        #
        # Custom validation in self._validateArguments
        #
        self._required = [
            "host",
            "port",
            "room",
            "playerPath",
            "playerClass",
        ]

        self._boolean = [
            "debug", "forceGuiPrompt", "noGui", "noStore",
            "dontSlowDownWithMe", "pauseOnLeave", "readyAtStart",
            "autoplayRequireSameFilenames", "clearGUIData", "rewindOnDesync",
            "slowOnDesync", "fastforwardOnDesync", "pauseOnLeave",
            "clearGUIData", "resetConfig", "showOSD", "showOSDWarnings",
            "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD",
            "showNonControllerOSD", "showDurationNotification",
            "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles",
            "onlySwitchToTrustedDomains"
        ]
        self._tristate = [
            "checkForUpdatesAutomatically",
            "autoplayInitialState",
        ]

        self._serialised = [
            "perPlayerArguments",
            "mediaSearchDirectories",
            "trustedDomains",
        ]

        self._numeric = [
            "slowdownThreshold",
            "rewindThreshold",
            "fastforwardThreshold",
            "autoplayMinUsers",
        ]

        self._iniStructure = {
            "server_data": ["host", "port", "password"],
            "client_settings": [
                "name", "room", "playerPath", "perPlayerArguments",
                "slowdownThreshold", "rewindThreshold", "fastforwardThreshold",
                "slowOnDesync", "rewindOnDesync", "fastforwardOnDesync",
                "dontSlowDownWithMe", "forceGuiPrompt", "filenamePrivacyMode",
                "filesizePrivacyMode", "unpauseAction", "pauseOnLeave",
                "readyAtStart", "autoplayMinUsers", "autoplayInitialState",
                "mediaSearchDirectories", "sharedPlaylistEnabled",
                "loopAtEndOfPlaylist", "loopSingleFiles",
                "onlySwitchToTrustedDomains", "trustedDomains"
            ],
            "gui": [
                "showOSD", "showOSDWarnings", "showSlowdownOSD",
                "showDifferentRoomOSD", "showSameRoomOSD",
                "showNonControllerOSD", "showDurationNotification"
            ],
            "general": [
                "language", "checkForUpdatesAutomatically",
                "lastCheckedForUpdates"
            ]
        }

        self._playerFactory = PlayerFactory()
コード例 #5
0
    def __init__(self):
        self._config = {
            "host": None,
            "port": constants.DEFAULT_PORT,
            "name": None,
            "debug": False,
            "forceGuiPrompt": True,
            "noGui": False,
            "noStore": False,
            "room": "",
            "password": None,
            "playerPath": None,
            "file": None,
            "playerArgs": [],
            "playerClass": None,
            "slowOnDesync": True,
            "rewindOnDesync": True,
            "malUsername": "",
            "malPassword": "",
            "malPassword": "",
            "filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
            "pauseOnLeave": False,
            "clearGUIData": False
        }

        #
        #Custom validation in self._validateArguments
        #
        self._required = [
            "host",
            "port",
            "name",
            "room",
            "playerPath",
            "playerClass",
        ]

        self._boolean = [
            "debug", "forceGuiPrompt", "noGui", "noStore", "slowOnDesync",
            "pauseOnLeave", "rewindOnDesync", "clearGUIData"
        ]

        self._iniStructure = {
            "server_data": ["host", "port", "password"],
            "client_settings": [
                "name", "room", "playerPath", "slowOnDesync", "rewindOnDesync",
                "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode",
                "pauseOnLeave"
            ],
            "mal": ["malPassword", "malUsername"]
        }

        #
        #Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
        #
        self._argparser = argparse.ArgumentParser(
            description=getMessage("en", "argument-description"),
            epilog=getMessage("en", "argument-epilog"))
        self._argparser.add_argument('--no-gui',
                                     action='store_true',
                                     help=getMessage("en", "nogui-argument"))
        self._argparser.add_argument('-a',
                                     '--host',
                                     metavar='hostname',
                                     type=str,
                                     help=getMessage("en", "host-argument"))
        self._argparser.add_argument('-n',
                                     '--name',
                                     metavar='username',
                                     type=str,
                                     help=getMessage("en", "name-argument"))
        self._argparser.add_argument('-d',
                                     '--debug',
                                     action='store_true',
                                     help=getMessage("en", "debug-argument"))
        self._argparser.add_argument('-g',
                                     '--force-gui-prompt',
                                     action='store_true',
                                     help=getMessage(
                                         "en", "force-gui-prompt-argument"))
        self._argparser.add_argument('--no-store',
                                     action='store_true',
                                     help=getMessage("en",
                                                     "no-store-argument"))
        self._argparser.add_argument('-r',
                                     '--room',
                                     metavar='room',
                                     type=str,
                                     nargs='?',
                                     help=getMessage("en", "room-argument"))
        self._argparser.add_argument('-p',
                                     '--password',
                                     metavar='password',
                                     type=str,
                                     nargs='?',
                                     help=getMessage("en",
                                                     "password-argument"))
        self._argparser.add_argument('--player-path',
                                     metavar='path',
                                     type=str,
                                     help=getMessage("en",
                                                     "player-path-argument"))
        self._argparser.add_argument('file',
                                     metavar='file',
                                     type=str,
                                     nargs='?',
                                     help=getMessage("en", "file-argument"))
        self._argparser.add_argument('--clear-gui-data',
                                     action='store_true',
                                     help=getMessage(
                                         "en", "clear-gui-data-argument"))
        self._argparser.add_argument('_args',
                                     metavar='options',
                                     type=str,
                                     nargs='*',
                                     help=getMessage("en", "args-argument"))

        self._playerFactory = PlayerFactory()