当前位置: 首页>>代码示例>>Python>>正文


Python Singleton.getLastResponse方法代码示例

本文整理汇总了Python中DPH_Singleton.Singleton.getLastResponse方法的典型用法代码示例。如果您正苦于以下问题:Python Singleton.getLastResponse方法的具体用法?Python Singleton.getLastResponse怎么用?Python Singleton.getLastResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DPH_Singleton.Singleton的用法示例。


在下文中一共展示了Singleton.getLastResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DPS_ServerConfig

# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getLastResponse [as 别名]

#.........这里部分代码省略.........
        # ===========================================================================
        #
        # ===========================================================================

    def keyCancel(self):
        printl("", self, "S")

        if self.newmode == 1:
            config.plugins.dreamplex.Entries.remove(self.current)
        ConfigListScreen.cancelConfirm(self, True)

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def keyYellow(self):
        printl("", self, "S")

        if self.useMappings:
            serverID = self.currentId
            self.session.open(DPS_Mappings, serverID)

        elif self.current.localAuth.value:
            # now that we know the server we establish global plexInstance
            self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))

            ipInConfig = "%d.%d.%d.%d" % tuple(self.current.ip.value)
            token = self.plexInstance.getPlexUserTokenForLocalServerAuthentication(ipInConfig)

            if token:
                self.current.myplexLocalToken.value = token
                self.current.myplexLocalToken.save()
                self.session.open(
                    MessageBox,
                    (_("Local Token:") + "\n%s \n" + _("for the user:") + "\n%s")
                    % (token, self.current.myplexTokenUsername.value),
                    MessageBox.TYPE_INFO,
                )
            else:
                response = self.plexInstance.getLastResponse()
                self.session.open(
                    MessageBox,
                    (_("Error:") + "\n%s \n" + _("for the user:") + "\n%s")
                    % (response, self.current.myplexTokenUsername.value),
                    MessageBox.TYPE_INFO,
                )

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def keyBlue(self):
        printl("", self, "S")

        # now that we know the server we establish global plexInstance
        self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))

        token = self.plexInstance.getNewMyPlexToken()

        if token:
            self.session.open(
                MessageBox,
                (_("myPlex Token:") + "\n%s \n" + _("for the user:") + "\n%s")
                % (token, self.current.myplexTokenUsername.value),
                MessageBox.TYPE_INFO,
            )
        else:
            response = self.plexInstance.getLastResponse()
            self.session.open(
                MessageBox,
                (_("Error:") + "\n%s \n" + _("for the user:") + "\n%s")
                % (response, self.current.myplexTokenUsername.value),
                MessageBox.TYPE_INFO,
            )

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def keyRed(self):
        printl("", self, "S")

        self.session.open(
            MessageBox,
            (_("myPlex Token:") + "\n%s \n" + _("myPlex Localtoken:") + "\n%s \n" + _("for the user:") + "\n%s")
            % (
                self.current.myplexToken.value,
                self.current.myplexLocalToken.value,
                self.current.myplexTokenUsername.value,
            ),
            MessageBox.TYPE_INFO,
        )

        printl("", self, "C")
开发者ID:jbollacke,项目名称:DreamPlex,代码行数:104,代码来源:DP_Server.py

示例2: DPS_ServerConfig

# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getLastResponse [as 别名]

#.........这里部分代码省略.........
			if machineIdentifier is not None:
				machineIdentifiers += xmlResponse.get("machineIdentifier")

		self.current.machineIdentifier.value = machineIdentifiers
		printl("machineIdentifier: " + str(self.current.machineIdentifier.value), self, "D")

		if self.current.connectionType.value == "2" or self.current.localAuth.value:
			self.keyBlue()
		else:
			self.saveNow()

		printl("", self, "C")

	#===========================================================================
	#
	#===========================================================================
	def saveNow(self, retval=None):
		printl("", self, "S")

		config.plugins.dreamplex.entriescount.save()
		config.plugins.dreamplex.Entries.save()
		config.plugins.dreamplex.save()
		configfile.save()

		self.close()

		printl("", self, "C")

	#===========================================================================
	#
	#===========================================================================
	def keyCancel(self):
		printl("", self, "S")

		if self.newmode == 1:
			config.plugins.dreamplex.Entries.remove(self.current)
		ConfigListScreen.cancelConfirm(self, True)

		printl("", self, "C")

	#===========================================================================
	#
	#===========================================================================
	def keyYellow(self):
		printl("", self, "S")

		if self.useMappings:
			serverID = self.currentId
			self.session.open(DPS_Mappings, serverID)

		elif self.current.localAuth.value:
			# now that we know the server we establish global plexInstance
			self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))

			ipInConfig = "%d.%d.%d.%d" % tuple(self.current.ip.value)
			token = self.plexInstance.getPlexUserTokenForLocalServerAuthentication(ipInConfig)

			if token:
				self.current.myplexLocalToken.value = token
				self.current.myplexLocalToken.save()
				self.session.open(MessageBox,(_("Local Token:") + "\n%s \n" + _("for the user:") + "\n%s") % (token, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO)
			else:
				response = self.plexInstance.getLastResponse()
				self.session.open(MessageBox,(_("Error:") + "\n%s \n" + _("for the user:") + "\n%s") % (response, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO)

		printl("", self, "C")

	#===========================================================================
	#
	#===========================================================================
	def keyBlue(self):
		printl("", self, "S")

		# now that we know the server we establish global plexInstance
		self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))

		token = self.plexInstance.getNewMyPlexToken()

		if token:
			self.session.openWithCallback(self.saveNow, MessageBox,(_("myPlex Token:") + "\n%s \n" + _("for the user:") + "\n%s \n" + _("with the id:") + "\n%s") % (token, self.current.myplexTokenUsername.value, self.current.myplexId.value), MessageBox.TYPE_INFO)
		else:
			response = self.plexInstance.getLastResponse()
			self.session.openWithCallback(self.saveNow, MessageBox,(_("Error:") + "\n%s \n" + _("for the user:") + "\n%s") % (response, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO)

		printl("", self, "C")

	#===========================================================================
	#
	#===========================================================================
	def keyRed(self):
		printl("", self, "S")

		if self.useHomeUsers:
			serverID = self.currentId
			plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))
			self.session.open(DPS_Users, serverID, plexInstance)

		#self.session.open(MessageBox,(_("myPlex Token:") + "\n%s \n" + _("myPlex Localtoken:") + "\n%s \n"+ _("for the user:") + "\n%s") % (self.current.myplexToken.value, self.current.myplexLocalToken.value, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO)

		printl("", self, "C")
开发者ID:DonDavici,项目名称:DreamPlex,代码行数:104,代码来源:DP_Server.py


注:本文中的DPH_Singleton.Singleton.getLastResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。