Beispiel #1
0
def updateKodi():
    global remote

    try:
        # Prompt for Kodi Update
        if kodi.get_setting('update_kodi') == 'true':
            if kodi.platform() == 'android' and remote['kodi_version'] != kodi.get_version():
                choice = xbmcgui.Dialog().yesno('idolpx Installer',
                                                'A new version of Kodi is available!',
                                                'Current version is [B]'+kodi.get_version()+'[/B].[CR]',
                                                'Would you like to install version [B]'+remote['kodi_version'] +'[/B]?')
                if choice == 1:
                    installer.installAPK(remote['kodi_url'])
                    
    except Exception, e: 
        kodi.debug('updateKodi: '+str(e))
Beispiel #2
0
            # Get Remote Settings
            try:
                if kodi.get_setting('update_test') != 'true':
                    current_version = current['config_version']
                else:
                    current_version = current['test_version']

                params = getParams()
                params['cv'] = current_version
                response = requests.get(kodi.get_setting('update_url'),
                                        params=params)
                remote = json.loads(response.text)

                # If kodi version is different on server then execute installer
                if kodi.get_setting('update_kodi') == 'true':
                    if kodi.platform() == 'android' and remote[
                            'kodi_version'] != kodi.get_version():

                        # Start idolpx Installer
                        kodi.execute('XBMC.RunScript(' + addon_id + ')', True)

                if kodi.get_setting('update_test') != 'true':
                    remote_version = remote['config_version']
                    url = remote['config_url']
                else:
                    remote_version = remote['test_version']
                    url = remote['test_url']

                # If config version is different on server then execute installer
                if current_version != remote_version:
                    kodi.log("New confguration version available.")
Beispiel #3
0
def main():
    dp = xbmcgui.DialogProgress()
    dp.create('idolpx Installer', 'Checking for update...', '',
              'Please wait...')
    dp.update(100)

    # Get Current Version
    update_file = xbmc.translatePath(os.path.join('special://',
                                                  'home')) + 'update.zip'

    current = json.loads(
        '{"config_version": "00000000","test_version": "00000000"}')
    path = xbmc.translatePath(os.path.join('special://', 'userdata'))
    version_file = path + 'version.json'
    try:
        current = json.load(open(version_file))
    except:
        pass

    # Get Remote Settings
    try:
        # Prompt for Device ID if it is not set
        if not kodi.get_setting('deviceid'):
            kb = xbmc.Keyboard('default', 'heading')
            kb.setHeading(
                'Enter your name or something so I know who you are \r\nand will allow you access to updates'
            )
            kb.setDefault('')
            kb.setHiddenInput(False)
            kb.doModal()
            if (kb.isConfirmed()):
                kb_input = kb.getText()
                if (len(kb_input) > 3):
                    kodi.set_setting('deviceid', kb_input)
                    kodi.notify('Device ID set!', '[' + kb_input + ']')
                else:
                    kodi.notify('Access denied!', 'Device ID not set.')
                    return
            else:
                kodi.notify('Access denied!', 'Device ID not set.')
                return

        # Prompt for Configuration Update
        if kodi.get_setting('update_test') != 'true':
            current_version = current['config_version']
        else:
            current_version = current['test_version']

        params = {
            'd': kodi.getInfoLabel('Network.MacAddress'),
            'os': kodi.getInfoLabel('System.OSVersionInfo'),
            'id': kodi.get_setting('deviceid'),
            'kv': kodi.get_version()
        }

        params['cv'] = current_version
        kodi.log('Config URL: ' + kodi.get_setting('update_url'))
        response = requests.get(kodi.get_setting('update_url'), params=params)
        remote = json.loads(response.text)
        kodi.log(json.dumps(remote))
        dp.close()

        if kodi.get_setting('update_test') != 'true':
            remote_version = remote['config_version']
            url = remote['config_url']
            hash = remote['config_md5']
        else:
            remote_version = remote['test_version']
            url = remote['test_url']
            hash = remote['test_md5']

        # Prompt for Kodi Update
        if kodi.get_setting('update_kodi') == 'true':
            if kodi.platform(
            ) == 'android' and remote['kodi_version'] != kodi.get_version():
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer', 'A new version of Kodi is available!',
                    'Current version is [B]' + kodi.get_version() +
                    '[/B].[CR]', 'Would you like to install version [B]' +
                    remote['kodi_version'] + '[/B]?')
                if choice == 1:
                    installer.installAPK(remote['kodi_url'])

        kodi.log('Update File: ' + update_file)
        if os.path.exists(update_file):
            url = '/update.zip'
            hash = ''
            choice = xbmcgui.Dialog().yesno(
                'idolpx Installer', 'An update file exists!', '',
                'Would you like to install this update?')
        else:
            if remote_version != current_version:
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer', 'A new configuration is available!',
                    'Current version is [B]' + current_version + '[/B].[CR]',
                    'Would you like to install version [COLOR green][B]' +
                    remote_version + '[/B][/COLOR]?')
            else:
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer',
                    'Current version is [B]' + current_version + '[/B].[CR]',
                    'Would you like to reinstall version [B]' +
                    remote_version + '[/B]?')

        if choice == 1:
            # Give service enough time to stop downloading
            time.sleep(3)

            if installer.installConfig(url, hash):

                # Save Installed Version to file
                with open(version_file, "w") as outfile:
                    json.dump(remote, outfile)

                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer',
                    'A restart is required. Would you like to restart Kodi now?'
                )
                if choice == 1:
                    kodi.kill()

                xbmcgui.Dialog().ok('idolpx Installer',
                                    'Update checks complete!')
            else:

                xbmcgui.Dialog().ok('idolpx Installer', 'Update canelled!')

    except Exception, e:
        kodi.log(str(e))
Beispiel #4
0
                remote = json.loads(response.text)

                # If kodi version is different on server then execute installer
                # if kodi.get_setting('update_kodi') == 'true':
                #     if kodi.platform() == 'android' and remote['kodi_version'] != kodi.get_version():

                #         # Start kbuilds Installer
                #         kodi.execute('XBMC.RunScript('+addon_id+')', True)

                # if kodi.get_setting('update_test') != 'true':
                #     remote_version = remote['config_version']
                #     url = remote['config_url']
                # else:
                #     remote_version = remote['test_version']
                #     url = remote['test_url']
                if kodi.platform() == 'raspberry':
                    remote_version = remote.get('raspberry')['config_version']
                    url = remote.get('raspberry')['config_url']
                else:
                    remote_version = remote.get('windows')['config_version']
                    url = remote.get('windows')['config_url']

                # If config version is different on server then execute installer
                if current_version != remote_version:
                    kodi.log(str(kodi.platform()))
                    kodi.log("New confguration version available.")

                    # Setup variables
                    path = xbmc.translatePath(
                        os.path.join('special://', 'home'))
                    filename = url.split('/')[-1]