本文整理匯總了Python中DPH_Singleton.Singleton.getXmlTreeFromUrl方法的典型用法代碼示例。如果您正苦於以下問題:Python Singleton.getXmlTreeFromUrl方法的具體用法?Python Singleton.getXmlTreeFromUrl怎麽用?Python Singleton.getXmlTreeFromUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DPH_Singleton.Singleton
的用法示例。
在下文中一共展示了Singleton.getXmlTreeFromUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DPS_ServerConfig
# 需要導入模塊: from DPH_Singleton import Singleton [as 別名]
# 或者: from DPH_Singleton.Singleton import getXmlTreeFromUrl [as 別名]
#.........這裏部分代碼省略.........
self.createSetup()
printl("", self, "C")
#===========================================================================
#
#===========================================================================
def keySave(self, stayOpen = False):
printl("", self, "S")
if self.newmode == 1:
config.plugins.dreamplex.entriescount.value += 1
config.plugins.dreamplex.entriescount.save()
#if self.current.machineIdentifier.value == "":
from DP_PlexLibrary import PlexLibrary
self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))
machineIdentifiers = ""
if self.current.connectionType.value == "2":
xmlResponse = self.plexInstance.getSharedServerForPlexUser()
machineIdentifier = xmlResponse.get("machineIdentifier")
if machineIdentifier is not None:
machineIdentifiers += machineIdentifier
servers = xmlResponse.findall("Server")
for server in servers:
machineIdentifier = server.get("machineIdentifier")
if machineIdentifier is not None:
machineIdentifiers += ", " + machineIdentifier
else:
xmlResponse = self.plexInstance.getXmlTreeFromUrl("http://" + self.plexInstance.g_currentServer)
machineIdentifier = xmlResponse.get("machineIdentifier")
if machineIdentifier is not None:
machineIdentifiers += xmlResponse.get("machineIdentifier")
self.current.machineIdentifier.value = machineIdentifiers
printl("machineIdentifier: " + str(self.current.machineIdentifier.value), self, "D")
config.plugins.dreamplex.entriescount.save()
config.plugins.dreamplex.Entries.save()
config.plugins.dreamplex.save()
configfile.save()
if not stayOpen:
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")
#===========================================================================
#
#===========================================================================
示例2: DPS_ServerConfig
# 需要導入模塊: from DPH_Singleton import Singleton [as 別名]
# 或者: from DPH_Singleton.Singleton import getXmlTreeFromUrl [as 別名]
#.........這裏部分代碼省略.........
self.createSetup()
printl("", self, "C")
#===========================================================================
#
#===========================================================================
def keySave(self):
printl("", self, "S")
if self.newmode == 1:
config.plugins.dreamplex.entriescount.value += 1
config.plugins.dreamplex.entriescount.save()
#if self.current.machineIdentifier.value == "":
from DP_PlexLibrary import PlexLibrary
self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.current))
machineIdentifiers = ""
if self.current.connectionType.value == "2":
xmlResponse = self.plexInstance.getSharedServerForPlexUser()
machineIdentifier = xmlResponse.get("machineIdentifier")
if machineIdentifier is not None:
machineIdentifiers += machineIdentifier
servers = xmlResponse.findall("Server")
for server in servers:
machineIdentifier = server.get("machineIdentifier")
if machineIdentifier is not None:
machineIdentifiers += ", " + machineIdentifier
else:
xmlResponse = self.plexInstance.getXmlTreeFromUrl("http://" + str(self.plexInstance.g_host) + ":" + str(self.plexInstance.serverConfig_port))
machineIdentifier = xmlResponse.get("machineIdentifier")
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")
#===========================================================================
#