Пример #1
0
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
Пример #2
0
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
Пример #3
0
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()
Пример #4
0
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()