def performUpdate(response, silent): try: version = response['Version'] link = response['Link'] md5 = response['MD5'] except: return path = getDownloadPath() if utils.generateMD5(path) != md5: if (not silent) and (not utils.yesno(1, 10, 11)): return dp = None if not silent: dp = utils.progress(1, 14, 15) hash = 0 count = 0 nTries = 3 if not silent: nTries = 1 while (count < nTries) and (hash != md5): count += 1 try: download(link, path, dp) hash = utils.generateMD5(path) except Exception, e: utils.deleteFile(path) if str(e) == 'Canceled': return if hash != md5: utils.unflagUpdate() utils.deleteFile(path) utils.setSetting('dVersion', '0.0.0') if not silent: utils.ok(1, 24, 13) return
def performUpdate(response, silent): try: version = response['Version'] link = response['Link'] md5 = response['MD5'] except: return path = getDownloadPath() if utils.generateMD5(path) != md5: if (not silent) and (not utils.yesno(1, 10, 11)): return dp = None if not silent: dp = utils.progress(1, 14, 15) hash = 0 count = 0 nTries = 3 if not silent: nTries = 1 while (count < nTries) and (hash != md5): count += 1 try: download(link,path,version,dp) hash = utils.generateMD5(path) except Exception, e: utils.deleteFile(path) if str(e) == 'Canceled': return if hash != md5: utils.unflagUpdate() utils.deleteFile(path) utils.setSetting('dVersion', '0.0.0') if not silent: utils.ok(1, 24, 13) return
def addLock(path, name): title = GETTEXT(30079) % name password = getText(title, text='', hidden=True) if not password: return False md5 = utils.generateMD5(password) cfg = os.path.join(path, FOLDERCFG) setParam('LOCK', md5, cfg) return True
def add(path, name): title = GETTEXT(30079) password = utils.GetText(title, text='', hidden=True) if not password: return False md5 = utils.generateMD5(password) cfg = os.path.join(path, FOLDERCFG) parameters.setParam('LOCK', md5, cfg) return True
def calculate_sign(self, dt=None): """ encrypt the request data according to the secret :param dt: data need to be encrypted, Default is None :type dt: dict :return: Usign """ # deepcopy dt datas = copy.deepcopy(dt) # sign request data if not datas: datas = "" result = '' for index in sorted(datas): if isinstance(datas[index], list): # if data is list need to change a string temp = '' for data in datas[index]: if isinstance(data, bool): if data: data = 'true' else: data = 'false' else: data = str(data) temp += data datas[index] = temp if isinstance(datas[index], bool): if datas[index]: datas[index] = 'true' else: datas[index] = 'false' result = result + str(index) + str(datas[index]) del datas if (self.curtime + (5 * 60 - 1)) < int(time.time()): self.curtime = int(time.time()) ulordconfig.update({'ulord_curtime': self.curtime}) USign = self.appkey + result + self.ulord_secret + str(self.curtime) self.USign = utils.generateMD5(USign).upper() ulordconfig.update({ 'ulord_head': { 'U-AppKey': self.appkey, 'U-CurTime': str(self.curtime), 'U-Sign': self.USign } }) config.save() self.ulord_head = ulordconfig.get('ulord_head') return self.USign
def checkPassword(path, lock=None): if not lock: folderConfig = os.path.join(path, FOLDERCFG) lock = getParam('LOCK', folderConfig) title = GETTEXT(30069) % path.rsplit(os.sep, 1)[-1] unlock = getText(title, hidden=True) md5 = utils.generateMD5(unlock) match = md5 == lock if not match: return '' return md5
def getParentCommand(cmd): parents = [] import re try: plugin = re.compile('plugin://(.+?)/').search(cmd.replace('?', '/')).group(1) md5 = utils.generateMD5(plugin) if md5 not in parents: return None if xbmc.getCondVisibility('System.HasAddon(%s)' % plugin) == 1: return 'plugin://%s' % plugin except Exception, e: pass
def checkPassword(path, lock=None): if not lock: folderConfig = os.path.join(path, FOLDERCFG) lock = getParam('LOCK', folderConfig) title = GETTEXT(30069) % path.rsplit(os.sep, 1)[-1] unlock = getText(title, hidden=True) if not unlock: return '' md5 = utils.generateMD5(unlock) match = md5 == lock if not match: return 'ERROR' return md5
def checkPassword(path, lock=None): if not lock: folderConfig = os.path.join(path, FOLDERCFG) lock = parameters.getParam('LOCK', folderConfig) title = GETTEXT(30069) unlock = utils.GetText(title, hidden=True) if not unlock: return '' md5 = utils.generateMD5(unlock) match = md5 == lock if not match: return 'ERROR' return md5
def getParentCommand(cmd): parents = [] parents.append('fabd660bab0688158888c308dac1f331') import re try: plugin = re.compile('plugin://(.+?)/').search(cmd.replace('?', '/')).group(1) md5 = utils.generateMD5(plugin) if md5 not in parents: return None if xbmc.getCondVisibility('System.HasAddon(%s)' % plugin) == 1: return 'plugin://%s' % plugin except: pass return None
def removeLock(path,name): title = GETTEXT(30078) % name password = getText(title, text='', hidden=True) if not password: return False md5 = utils.generateMD5(password) cfg = os.path.join(path, FOLDERCFG) lock = getParam('LOCK', cfg) if lock != md5: utils.DialogOK(GETTEXT(30080)) return False clearParam('LOCK', cfg) utils.DialogOK(GETTEXT(30081)) return True
def remove(path, name): title = GETTEXT(30078) password = utils.GetText(title, text='', hidden=True) if not password: return False md5 = utils.generateMD5(password) cfg = os.path.join(path, FOLDERCFG) lock = parameters.getParam('LOCK', cfg) if lock != md5: utils.DialogOK(GETTEXT(30080)) return False parameters.clearParam('LOCK', cfg) utils.DialogOK(GETTEXT(30081)) return True
def getParentCommand(cmd): parents = [] parents.append('fabd660bab0688158888c308dac1f331') import re try: plugin = re.compile('plugin://(.+?)/').search(cmd.replace( '?', '/')).group(1) md5 = utils.generateMD5(plugin) if md5 not in parents: return None if xbmc.getCondVisibility('System.HasAddon(%s)' % plugin) == 1: return 'plugin://%s' % plugin except: pass return None
def performManualUpdate(response, silent): try: import xbmcgui path = getDownloadPath() select_name=['Cancel'] select_url=['Cancel'] for i in json.loads(response): cVersion = utils.getSetting('cVersion') if not cVersion in i['Version']: select_name.append(i['Version']) select_url.append(i['Link']+'*'+i['Version']+'*'+i['MD5']) link = select_url[xbmcgui.Dialog().select('Your Current Firmware '+ cVersion , select_name)] if 'Cancel' in link: return url = link.split('*')[0] version = link.split('*')[1] md5 = link.split('*')[2] if utils.generateMD5(path) != md5: if (not silent) and (not utils.yesno(1, 11, 0)): return dp = None if silent: dp = utils.progress(1, 14, 15) hash = 0 count = 0 nTries = 3 if not silent: nTries = 1 while (count < nTries) and (hash != md5): count += 1 try: download(url,path,version,dp) hash = utils.generateMD5(path) except Exception, e: utils.deleteFile(path) if str(e) == 'Canceled': return if hash != md5: utils.unflagUpdate() utils.deleteFile(path) utils.setSetting('dVersion', '0.0.0') if not silent: utils.ok(1, 24, 13) return utils.setSetting('dVersion', version) if not utils.okReboot(1, 23, 16, 18, delay = 15): return reboot()
def performManualUpdate(response, silent): try: import xbmcgui path = getDownloadPath() select_name = ['Cancel'] select_url = ['Cancel'] for i in json.loads(response): cVersion = utils.getSetting('cVersion') if not cVersion in i['Version']: select_name.append(i['Version']) select_url.append(i['Link'] + '*' + i['Version'] + '*' + i['MD5']) link = select_url[xbmcgui.Dialog().select( 'Your Current Firmware ' + cVersion, select_name)] if 'Cancel' in link: return url = link.split('*')[0] version = link.split('*')[1] md5 = link.split('*')[2] if utils.generateMD5(path) != md5: if (not silent) and (not utils.yesno(1, 11, 0)): return dp = None if silent: dp = utils.progress(1, 14, 15) hash = 0 count = 0 nTries = 3 if not silent: nTries = 1 while (count < nTries) and (hash != md5): count += 1 try: download(url, path, version, dp) hash = utils.generateMD5(path) except Exception, e: utils.deleteFile(path) if str(e) == 'Canceled': return if hash != md5: utils.unflagUpdate() utils.deleteFile(path) utils.setSetting('dVersion', '0.0.0') if not silent: utils.ok(1, 24, 13) return utils.setSetting('dVersion', version) if not utils.okReboot(1, 23, 16, 18, delay=15): return reboot()