def checkServerState(self): printl("", self, "S") self.g_wolon = self.g_serverConfig.wol.value self.g_wakeserver = str(self.g_serverConfig.wol_mac.value) self.g_woldelay = int(self.g_serverConfig.wol_delay.value) connectionType = str(self.g_serverConfig.connectionType.value) if connectionType == "0": ip = "%d.%d.%d.%d" % tuple(self.g_serverConfig.ip.value) port = int(self.g_serverConfig.port.value) isOnline = testPlexConnectivity(ip, port) elif connectionType == "2": #state = testInetConnectivity("http://my.plexapp.com") isOnline = True else: isOnline = testInetConnectivity() if isOnline: stateText = "Online" else: stateText = "Offline" printl("Plexserver State: " + str(stateText), self, "I") if not isOnline: if self.g_wolon == True and connectionType == "0": self.showWakeMessage() else: self.showOfflineMessage() else: self.session.open(DPS_ServerMenu, self.g_serverConfig) printl("", self, "C")
def checkServerState(self): printl("", self, "S") self.g_wolon = self.g_serverConfig.wol.value self.g_wakeserver = str(self.g_serverConfig.wol_mac.value) self.g_woldelay = int(self.g_serverConfig.wol_delay.value) connectionType = str(self.g_serverConfig.connectionType.value) if connectionType == "0": ip = "%d.%d.%d.%d" % tuple(self.g_serverConfig.ip.value) port = int(self.g_serverConfig.port.value) isOnline = testPlexConnectivity(ip, port) elif connectionType == "2": #state = testInetConnectivity("http://my.plexapp.com") isOnline = True else: isOnline = testInetConnectivity() if isOnline: stateText = "Online" else: stateText = "Offline" printl("Plexserver State: " + str(stateText), self, "I") if not isOnline: if self.g_wolon == True and connectionType == "0": self.showWakeMessage() else: self.showOfflineMessage() else: self.getServerData() printl("", self, "C")
def checkForUpdate(self, silent=False): printl("", self, "S") self.package = "python-pyopenssl" if testInetConnectivity() and self.checkInstallationState(True): printl("Starting request", self, "D") conn = httplib.HTTPSConnection("api.github.com", timeout=10, port=443) conn.request(url="/repos/DonDavici/DreamPlex/tags", method="GET", headers=getUserAgentHeader()) data = conn.getresponse() self.response = data.read() printl("response: " + str(self.response), self, "D") starter = 19 closer = self.response.find('",', 0, 50) printl("closer: " + str(closer), self, "D") latestVersion = self.response[ starter: closer] # is a bit dirty but better than forcing users to install simplejson printl("latestVersion: " + str(latestVersion), self, "D") installedVersion = getVersion() printl("InstalledVersion: " + str(installedVersion), self, "D") isBeta = self.checkIfBetaVersion(latestVersion) printl("isBeta: " + str(isBeta), self, "D") if config.plugins.dreamplex.updateType.value == "1" and isBeta == True: # Stable latestVersion = self.searchLatestStable() if latestVersion > installedVersion: self.latestVersion = latestVersion self.session.openWithCallback( self.startUpdate, MessageBox, _("Your current Version is " + str(installedVersion) + "\nUpdate to revision " + str(latestVersion) + " found!\n\nDo you want to update now?"), MessageBox.TYPE_YESNO) else: if not silent: self.session.openWithCallback(self.close, MessageBox, _("No update available"), MessageBox.TYPE_INFO) else: if not silent: self.session.openWithCallback( self.close, MessageBox, _("No internet connection available or openssl is not installed!" ), MessageBox.TYPE_INFO) printl("", self, "C")
def checkForUpdate(self,controller): self.controller = controller log("",self,"Check for update....") self.controller.setStatusBarInfo(_("Check for update..")) if testInetConnectivity(): self.url = config.plugins.enigmalight.url.value + config.plugins.enigmalight.updatexml.value log("",self,"Checking URL: " + self.url) try: f = urllib2.urlopen(self.url) html = f.read() dom = parseString(html) update = dom.getElementsByTagName("update")[0] version = update.getElementsByTagName("version")[0] remoteversion = version.childNodes[0].data urls = update.getElementsByTagName("url") currentversion = getVersion() currentbeta = currentversion[-2:] remotebeta = remoteversion[-2:] self.remoteurl = "" for url in urls: self.remoteurl = url.childNodes[0].data #print("""Version: %s - URL: %s""" % (remoteversion, self.remoteurl)) if currentbeta < remotebeta: self.latestVersion = remoteversion self.controller.setStatusBarInfo(_("New update available !!")) #if self.session != None: self.session.openWithCallback(self.startUpdate, MessageBox,_("Your current Version is " + str(currentversion) + "\nUpdate to " + str(remoteversion) + " found!\n\nDo you want to update now?"), MessageBox.TYPE_YESNO) else: self.controller.setStatusBarInfo(_("No update available..")) #if self.session != None: showMessage(self.session, _("No update available.."), "I") except: from traceback import format_exc log("",self,"Error: " +format_exc()) try: log("",self,"Could not download HTTP Page") open(getCrashFilePath(),"w").write(format_exc()) except: pass else: self.controller.setStatusBarInfo(_("No Internetconnection..")) self.session.openWithCallback(self.close, MessageBox,_("No internet connection available or curl is not installed!"), MessageBox.TYPE_INFO)
def checkForUpdate(self): printl("", self, "S") if testInetConnectivity() and self.checkCurlInstallation(True): printl("Starting request", self, "D") curl_string = 'curl -s -k "%s"' % "https://api.github.com/repos/DonDavici/DreamPlex/tags" printl("curl_string: " + str(curl_string), self, "D") self.response = popen(curl_string).read() printl("response: " + str(self.response), self, "D") starter = 19 closer = self.response.find('",', 0, 50) printl("closer: " + str(closer), self, "D") latestVersion = self.response[ starter: closer] # is a bit dirty but better than forcing users to install simplejson printl("latestVersion: " + str(latestVersion), self, "D") installedVersion = getVersion() printl("InstalledVersion: " + str(installedVersion), self, "D") isBeta = self.checkIfBetaVersion(latestVersion) printl("isBeta: " + str(isBeta), self, "D") if config.plugins.dreamplex.updateType.value == "1" and isBeta == True: # Stable latestVersion = self.searchLatestStable() if latestVersion > installedVersion: self.latestVersion = latestVersion self.session.openWithCallback( self.startUpdate, MessageBox, _("Your current Version is " + str(installedVersion) + "\nUpdate to revision " + str(latestVersion) + " found!\n\nDo you want to update now?"), MessageBox.TYPE_YESNO) else: self.session.openWithCallback(self.close, MessageBox, _("No update available"), MessageBox.TYPE_INFO) else: self.session.openWithCallback( self.close, MessageBox, _("No internet connection available or curl is not installed!" ), MessageBox.TYPE_INFO) printl("", self, "C")
def checkForUpdate(self, silent=False): printl("", self, "S") self.package = "python-pyopenssl" if testInetConnectivity() and self.checkInstallationState(True): printl( "Starting request", self, "D") conn = httplib.HTTPSConnection("api.github.com",timeout=10, port=443) conn.request(url="/repos/DonDavici/DreamPlex/tags", method="GET", headers=getUserAgentHeader()) data = conn.getresponse() self.response = data.read() printl("response: " + str(self.response), self, "D") starter = 19 closer = self.response.find('",', 0, 50) printl("closer: " + str(closer), self, "D") latestVersion = self.response[starter:closer] # is a bit dirty but better than forcing users to install simplejson printl("latestVersion: " + str(latestVersion), self, "D") installedVersion = getVersion() printl("InstalledVersion: " + str(installedVersion), self, "D") isBeta = self.checkIfBetaVersion(latestVersion) printl("isBeta: " + str(isBeta), self, "D") if config.plugins.dreamplex.updateType.value == "1" and isBeta == True: # Stable latestVersion = self.searchLatestStable() if latestVersion > installedVersion: self.latestVersion = latestVersion self.session.openWithCallback(self.startUpdate, MessageBox,_("Your current Version is " + str(installedVersion) + "\nUpdate to revision " + str(latestVersion) + " found!\n\nDo you want to update now?"), MessageBox.TYPE_YESNO) else: if not silent: self.session.openWithCallback(self.close, MessageBox,_("No update available"), MessageBox.TYPE_INFO) else: if not silent: self.session.openWithCallback(self.close, MessageBox,_("No internet connection available or openssl is not installed!"), MessageBox.TYPE_INFO) printl("", self, "C")
def checkForUpdate(self): printl("", self, "S") if testInetConnectivity(): printl( "Starting request", self, "D") curl_string = 'curl -s -k "%s"' % "https://api.github.com/repos/DonDavici/DreamPlex/tags" printl("curl_string: " + str(curl_string), self, "D") self.response = popen(curl_string).read() printl("response: " + str(self.response), self, "D") starter = 19 closer = self.response.find('",', 0, 50) printl("closer: " + str(closer), self, "D") latestVersion = self.response[starter:closer] # is a bit dirty but better than forcing users to install simplejson printl("latestVersion: " + str(latestVersion), self, "D") installedVersion = getVersion() printl("InstalledVersion: " + str(installedVersion), self, "D") isBeta = self.checkIfBetaVersion(latestVersion) printl("isBeta: " + str(isBeta), self, "D") if config.plugins.dreamplex.updateType.value == "1" and isBeta == True: # Stable latestVersion = self.searchLatestStable() if latestVersion > installedVersion: self.latestVersion = latestVersion self.session.openWithCallback(self.startUpdate, MessageBox,_("Your current Version is " + str(installedVersion) + "\nUpdate to revision " + str(latestVersion) + " found!\n\nDo you want to update now?"), MessageBox.TYPE_YESNO) else: self.session.openWithCallback(self.close, MessageBox,_("No update available"), MessageBox.TYPE_INFO) else: self.session.openWithCallback(self.close, MessageBox,_("No internet connection available!"), MessageBox.TYPE_INFO) printl("", self, "C")