Example #1
0
def PatchAdvanced(name, url, description):
    if base_info.workingURL(url) == False: return False

    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    patchname = name
    dp = xbmcgui.DialogProgress()
    dp.create(ADDONTITLE, "", "", "[B]Advanced Settings: [/B]" + patchname)
    patchname = "advsettings"
    lib = os.path.join(path, patchname + '.zip')

    try:
        os.remove(lib)
    except:
        pass

    dialog = xbmcgui.Dialog()
    downloader.download(url, lib, dp)

    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "Extracting Zip Please Wait", "", " ")
    extract.all(lib, addonfolder, dp)
    time.sleep(1)
    try:
        os.remove(lib)
    except:
        pass
    xbmc.executebuiltin("Container.Refresh")

    dialog.ok(
        ADDONTITLE, "[COLOR snow]Advanced Settings installed![/COLOR]",
        "[COLOR white]You should now see an imporvment in buffering[/COLOR]")
Example #2
0
    def gui(self, name, over=False):
        if name == CONFIG.get_setting('buildname'):
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Would you like to apply the guifix for:'.format(CONFIG.COLOR2) + '\n' + '[COLOR {0}]{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, name),
                                   nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                                   yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]')
        else:
            yes_pressed = self.dialog.yesno("{0} - [COLOR red]WARNING!![/COLOR]".format(CONFIG.ADDONTITLE),
                               "[COLOR {0}][COLOR {1}]{2}[/COLOR] community build is not currently installed.".format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + "Would you like to apply the guiFix anyways?.[/COLOR]",
                               nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                               yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]')
        if yes_pressed:
            guizip = check.check_build(name, 'gui')
            zipname = name.replace('\\', '').replace('/', '').replace(':', '').replace('*', '').replace('?', '').replace('"', '').replace('<', '').replace('>', '').replace('|', '')

            response = tools.open_url(guizip, check=True)
            if not response:
                logging.log_notify(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]GuiFix: Invalid Zip Url![/COLOR]'.format(CONFIG.COLOR2))
                return

            self.dialogProgress.create(CONFIG.ADDONTITLE, '[COLOR {0}][B]Downloading GuiFix:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name), '', 'Please Wait')

            lib = os.path.join(CONFIG.PACKAGES, '{0}_guisettings.zip'.format(zipname))
            
            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(guizip, lib)
            xbmc.sleep(500)
            
            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass
                    
                return
            
            title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name)
            self.dialogProgress.update(0, title + '\n' + 'Please Wait')
            extract.all(lib, CONFIG.USERDATA, title=title)
            self.dialogProgress.close()
            skin.skin_to_default('Build Install')
            skin.look_and_feel_data('save')
            installed = db.grab_addons(lib)
            db.addon_database(installed, 1, True)

            self.dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]To save changes you now need to force close Kodi, Press OK to force close Kodi[/COLOR]".format(CONFIG.COLOR2))
            tools.kill_kodi(over=True)
        else:
            logging.log_notify(CONFIG.ADDONTITLE,
                               '[COLOR {0}]GuiFix: Cancelled![/COLOR]'.format(CONFIG.COLOR2))
Example #3
0
def wizard_update(startup=None):
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]There is a new version of the [COLOR {1}]{2}[/COLOR]!'.format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   'Would you like to download [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, ver),
                                   nolabel='[B][COLOR red]Remind Me Later[/COLOR][/B]',
                                   yeslabel="[B][COLOR springgreen]Update Wizard[/COLOR][/B]")
            if yes:
                from resources.libs.common import tools

                logging.log("[Auto Update Wizard] Installing wizard v{0}".format(ver))
                progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Downloading Update...'.format(CONFIG.COLOR2), '',
                              'Please Wait[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES, '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(0, "", "Installing {0} update".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                force_update()
                xbmc.sleep(1000)
                logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   '[COLOR {0}]Add-on updated[/COLOR]'.format(CONFIG.COLOR2))
                logging.log("[Auto Update Wizard] Wizard updated to v{0}".format(ver))
                tools.remove_file(os.path.join(CONFIG.ADDONDATA, 'settings.xml'))
                window.show_save_data_settings()
                if startup:
                    xbmc.executebuiltin('RunScript({0}/startup.py)'.format(CONFIG.PLUGIN))
                return
            else:
                logging.log("[Auto Update Wizard] Install New Wizard Ignored: {0}".format(ver))
        else:
            if not startup:
                logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   "[COLOR {0}]No New Version of Wizard[/COLOR]".format(CONFIG.COLOR2))
            logging.log("[Auto Update Wizard] No New Version v{0}".format(ver))
    else:
        logging.log("[Auto Update Wizard] Url for wizard file not valid: {0}".format(CONFIG.BUILDFILE))
Example #4
0
    def install_addon_from_url(self, plugin, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs import skin

        response = tools.open_url(url, check=True)

        if not response:
            logging.log_notify(
                "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(
                    CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]URL inválido zip![/COLOR]'.
                format(CONFIG.COLOR1, plugin, CONFIG.COLOR2))
            return

        tools.ensure_folders(CONFIG.PACKAGES)

        self.progress_dialog.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, plugin) + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        urlsplits = url.split('/')
        lib = os.path.join(CONFIG.PACKAGES, urlsplits[-1])

        try:
            os.remove(lib)
        except:
            pass

        Downloader().download(url, lib)
        title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, plugin)
        self.progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
        self.progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Instalando Dependencias[/COLOR]'.format(CONFIG.COLOR2))
        installed(plugin)
        installlist = db.grab_addons(lib)
        logging.log(str(installlist))
        db.addon_database(installlist, 1, True)
        self.install_dependency(plugin)
        self.progress_dialog.close()

        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        xbmc.executebuiltin('Container.Refresh()')

        for item in installlist:
            if item.startswith('skin.') and not item == 'skin.shortcuts':
                if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                    CONFIG.set_setting('defaultskinignore', 'true')
                skin.switch_to_skin(item, 'Skin Installer')
Example #5
0
def install_addon_from_url(name, url):
    from resources.libs.downloader import Downloader
    from resources.libs import db
    from resources.libs import extract
    from resources.libs.common import logging
    from resources.libs import skin
    from resources.libs.common import tools

    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(url, check=True)

    if not response:
        logging.log_notify(
            "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
            '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.
            format(CONFIG.COLOR1, name, CONFIG.COLOR2))
        return
    if not os.path.exists(CONFIG.PACKAGES):
        os.makedirs(CONFIG.PACKAGES)

    progress_dialog.create(
        CONFIG.ADDONTITLE,
        '[COLOR {0}][B]Downloading:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1,
            name), '', '[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
    urlsplits = url.split('/')
    lib = os.path.join(CONFIG.PACKAGES, urlsplits[-1])
    try:
        os.remove(lib)
    except:
        pass
    Downloader().download(url, lib)
    title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
        CONFIG.COLOR2, CONFIG.COLOR1, name)
    progress_dialog.update(
        0, title, '', '[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
    percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
    progress_dialog.update(
        0, title, '',
        '[COLOR {0}]Installing Dependencies[/COLOR]'.format(CONFIG.COLOR2))
    installed(name)
    installlist = db.grab_addons(lib)
    logging.log(str(installlist))
    db.addon_database(installlist, 1, True)
    install_dependency(name, progress_dialog)
    progress_dialog.close()

    xbmc.executebuiltin('UpdateAddonRepos()')
    xbmc.executebuiltin('UpdateLocalAddons()')
    xbmc.executebuiltin('Container.Refresh()')

    for item in installlist:
        if item.startswith('skin.') and not item == 'skin.shortcuts':
            if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                CONFIG.set_setting('defaultskinignore', 'true')
            skin.switch_to_skin(item, 'Skin Installer')
Example #6
0
    def install_skin(self, name, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs.common import logging
        from resources.libs import skin
        from resources.libs.common import tools

        progress_dialog = xbmcgui.DialogProgress()

        response = tools.open_url(url, check=False)

        if not response:
            logging.log_notify(
                "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(
                    CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Url del Zip Inválida![/COLOR]'
                .format(CONFIG.COLOR1, name, CONFIG.COLOR2))
            return

        if not os.path.exists(CONFIG.PACKAGES):
            os.makedirs(CONFIG.PACKAGES)

        progress_dialog.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))

        urlsplits = url.split('/')
        lib = xbmc.makeLegalFilename(
            os.path.join(CONFIG.PACKAGES, urlsplits[-1]))
        try:
            os.remove(lib)
        except:
            pass
        Downloader().download(url, lib)
        title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, name)
        progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)
        installed = db.grab_addons(lib)
        db.addon_database(installed, 1, True)
        progress_dialog.close()
        logging.log_notify(
            "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(CONFIG.COLOR1),
            '[COLOR {0}]{1}: Instalado![/COLOR]'.format(CONFIG.COLOR2, name))
        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        for item in installed:
            if item.startswith('skin.') and not item == 'skin.shortcuts':
                if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                    CONFIG.set_setting('defaultskinignore', 'true')
                skin.switch_to_skin(item, 'Skin Installer')
        xbmc.executebuiltin('Container.Refresh()')
Example #7
0
def wizard_update():
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Existe uma nova versão do {1}!'.format(CONFIG.COLOR2, CONFIG.ADDONTITLE)
                                   +'\n'+'Você gostaria de baixar [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, ver),
                                   nolabel='[B][COLOR red]Você gostaria de baixar[/COLOR][/B]',
                                   yeslabel="[B][COLOR springgreen]Assistente de atualização[/COLOR][/B]")
            if yes:
                from resources.libs import db
                from resources.libs.common import tools

                logging.log("[Assistente de atualização automática] Assistente de instalação v{0}".format(ver))
                progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Download da atualização...'.format(CONFIG.COLOR2)
                                        +'\n'+''
                                        +'\n'+'Por favor, aguarde...[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES, '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(0, '\n'+"Instalando{0} atualizar".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                db.force_check_updates(auto=True, over=True)
                xbmc.sleep(1000)
                logging.log_notify(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Add-on atualizado[/COLOR]'.format(CONFIG.COLOR2))
                logging.log("[Assistente de atualização automática] Assistente atualizado para v{0}".format(ver))
                tools.remove_file(os.path.join(CONFIG.ADDON_DATA, 'settings.xml'))
                window.show_save_data_settings()
            else:
                logging.log("[Assistente de atualização automática] Instalar novo assistente ignorado: {0}".format(ver))
        else:
            logging.log("[Assistente de atualização automática] Sem nova versão v{0}".format(ver))
    else:
        logging.log("[Assistente de atualização automática] Url para o arquivo do assistente não é válido: {0}".format(CONFIG.BUILDFILE))
Example #8
0
 def install_addon_pack(self, name, url):
     from resources.libs.downloader import Downloader
     from resources.libs import db
     from resources.libs import extract
     from resources.libs.common import logging
     from resources.libs.common import tools
     if 64 - 64: o00ooo0 / OoOoOO00 - O0 - I11i
     O0oOoOOOoOO = xbmcgui.DialogProgress()
     if 38 - 38: I1i1iI1i
     oo0Ooo0 = tools.open_url(url, check=True)
     if 7 - 7: O0.o0OO0 % I1ii11iIi11i - I1IiiI - iIii1I11I1II1
     if not oo0Ooo0:
         logging.log_notify(
             "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
             '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.
             format(CONFIG.COLOR1, name, CONFIG.COLOR2))
         return
         if 36 - 36: Oo0ooO0oo0oO % o00ooo0 % Oo0Ooo - I1ii11iIi11i
     if not os.path.exists(CONFIG.PACKAGES):
         os.makedirs(CONFIG.PACKAGES)
         if 22 - 22: iIii1I11I1II1 / Oo0Ooo * I1ii11iIi11i % o0OO0
     O0oOoOOOoOO.create(
         CONFIG.ADDONTITLE,
         '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
         format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     Ii11Ii1I = url.split('/')
     O00oO = xbmc.makeLegalFilename(
         os.path.join(CONFIG.PACKAGES, Ii11Ii1I[-1]))
     try:
         os.remove(O00oO)
     except:
         pass
     Downloader().download(url, O00oO)
     I1 = '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
         CONFIG.COLOR2, CONFIG.COLOR1, name)
     O0oOoOOOoOO.update(
         0, I1 + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     OO00Oo, O0OOO0OOoO0O, O00Oo000ooO0 = extract.all(O00oO,
                                                      CONFIG.ADDONS,
                                                      title=I1)
     IiiIII111iI = db.grab_addons(O00oO)
     db.addon_database(IiiIII111iI, 1, True)
     O0oOoOOOoOO.close()
     logging.log_notify(
         "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
         '[COLOR {0}]{1}: Instalado![/COLOR]'.format(CONFIG.COLOR2, name))
     xbmc.executebuiltin('UpdateAddonRepos()')
     xbmc.executebuiltin('UpdateLocalAddons()')
     xbmc.executebuiltin('Container.Refresh()')
     if 85 - 85: oO0o % i11iIiiIii - o0OO0 * OoooooooOO / I1IiiI % I1IiiI
     if 1 - 1: OoO0O00 - oO0o.I11i.OoO0O00 / Oo0Ooo + I11i
Example #9
0
    def _from_file(self, file, loc):
        from resources.libs import db
        from resources.libs import extract

        display = os.path.split(file)
        filename = display[1]
        packages = os.path.join(CONFIG.PACKAGES, filename)

        if not self.external:
            try:
                zipfile.ZipFile(file, 'r', allowZip64=True)
            except zipfile.BadZipFile as e:
                from resources.libs.common import logging
                logging.log(e, level=xbmc.LOGERROR)
                self.progress_dialog.update(
                    0,
                    '[COLOR {0}]No se puede leer el archivo zip desde la ubicación actual.'
                    .format(CONFIG.COLOR2) + '\n' +
                    'Copiando archivo a paquetes')
                xbmcvfs.copy(file, packages)
                file = xbmcvfs.translatePath(packages)
                self.progress_dialog.update(
                    0, '\n' + 'Copiar el archivo a paquetes: Completo')
                zipfile.ZipFile(file, 'r', allowZip64=True)
        else:
            from resources.libs.downloader import Downloader
            Downloader().download(file, packages)

        self._prompt_for_wipe()

        self.progress_dialog.update(
            0, 'Instalación de una Copia de Seguridad Externa' + '\n' +
            'Espere por Favor')
        percent, errors, error = extract.all(file, loc)
        self._view_errors(percent, errors, error, file)

        CONFIG.set_setting('installed', 'true')
        CONFIG.set_setting('extract', percent)
        CONFIG.set_setting('errors', errors)

        if self.external:
            try:
                os.remove(file)
            except:
                pass

        db.force_check_updates(over=True)

        tools.kill_kodi(
            msg=
            '[COLOR {0}]Para guardar los cambios, es necesario Forzar el Cierre de Kodi. Te gustaria continuar?[/COLOR]'
            .format(CONFIG.COLOR2))
Example #10
0
    def install_addon_pack(self, name, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs.common import logging
        from resources.libs.common import tools

        progress_dialog = xbmcgui.DialogProgress()

        response = tools.open_url(url, check=True)

        if not response:
            logging.log_notify(
                "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(
                    CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Url del Zip Inválida![/COLOR]'
                .format(CONFIG.COLOR1, name, CONFIG.COLOR2))
            return

        if not os.path.exists(CONFIG.PACKAGES):
            os.makedirs(CONFIG.PACKAGES)

        progress_dialog.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        urlsplits = url.split('/')
        lib = xbmc.makeLegalFilename(
            os.path.join(CONFIG.PACKAGES, urlsplits[-1]))
        try:
            os.remove(lib)
        except:
            pass
        Downloader().download(url, lib)
        title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, name)
        progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
        installed = db.grab_addons(lib)
        db.addon_database(installed, 1, True)
        progress_dialog.close()
        logging.log_notify(
            "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(CONFIG.COLOR1),
            '[COLOR {0}]{1}: Instalado![/COLOR]'.format(CONFIG.COLOR2, name))
        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        xbmc.executebuiltin('Container.Refresh()')
Example #11
0
    def _from_file(self, file, loc):
        from resources.libs import db
        from resources.libs import extract

        display = os.path.split(file)
        filename = display[1]
        packages = os.path.join(CONFIG.PACKAGES, filename)

        if not self.external:
            try:
                zipfile.ZipFile(file, 'r')
            except zipfile.BadZipFile as e:
                from resources.libs.common import logging
                logging.log(e, level=xbmc.LOGERROR)
                self.progress_dialog.update(
                    0,
                    '[COLOR {0}]Unable to read zip file from current location.'
                    .format(CONFIG.COLOR2), 'Copying file to packages')
                xbmcvfs.copy(file, packages)
                file = xbmc.translatePath(packages)
                self.progress_dialog.update(
                    0, '', 'Copying file to packages: Complete')
                zipfile.ZipFile(file, 'r')
        else:
            from resources.libs.downloader import Downloader
            Downloader().download(file, packages)

        self._prompt_for_wipe()

        self.progress_dialog.update(0, 'Installing External Backup', '',
                                    'Please Wait')
        percent, errors, error = extract.all(file, loc)
        self._view_errors(percent, errors, error, file)

        CONFIG.set_setting('installed', 'true')
        CONFIG.set_setting('extract', str(percent))
        CONFIG.set_setting('errors', str(errors))

        if not self.external:
            try:
                os.remove(file)
            except:
                pass

        db.force_check_updates(over=True)

        tools.kill_kodi(
            msg=
            '[COLOR {0}]To save changes, Kodi needs to be force closed. Would you like to continue?[/COLOR]'
            .format(CONFIG.COLOR2))
Example #12
0
    def _finish(self, file, loc, zname):
        from resources.libs import extract
        from resources.libs import db
        from resources.libs.common import tools

        dialog = xbmcgui.Dialog()
        progress_dialog = xbmcgui.DialogProgress()

        self._prompt_for_wipe()

        percent, errors, error = extract.all(file, loc)

        if int(errors) >= 1:
            if dialog.yesno(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}][COLOR {1}]{2}[/COLOR]'.format(
                        CONFIG.COLOR2, CONFIG.COLOR1, zname),
                    'Completed: [COLOR {0}]{1}{2}[/COLOR] [Errors: [COLOR {3}]{4}[/COLOR]]'
                    .format(CONFIG.COLOR1, percent, '%', CONFIG.COLOR1,
                            errors),
                    'Would you like to view the errors?[/COLOR]',
                    nolabel='[B][COLOR red]No Thanks[/COLOR][/B]',
                    yeslabel='[B][COLOR springgreen]View Errors[/COLOR][/B]'):

                from resources.libs.gui import window
                window.show_text_box("Viewing Errors", error.replace('\t', ''))
        CONFIG.set_setting('installed', 'true')
        CONFIG.set_setting('extract', str(percent))
        CONFIG.set_setting('errors', str(errors))

        if self.external:
            try:
                os.remove(file)
            except:
                pass

        # binaries_done = self._binaries()
        db.force_check_updates(over=True)

        # if not binaries_done:
        # dialog.ok(CONFIG.ADDONTITLE, '[COLOR {0}]There was an error while restoring. The build may not function correctly.[/COLOR]'.format(CONFIG.COLOR2))

        tools.kill_kodi(
            msg=
            '[COLOR {0}]To save changes, Kodi needs to be force closed. Would you like to continue?[/COLOR]'
            .format(CONFIG.COLOR2))
Example #13
0
    def _from_file(self, file, loc):
        from resources.libs import db
        from resources.libs import extract

        display = os.path.split(file)
        filename = display[1]
        packages = os.path.join(CONFIG.PACKAGES, filename)

        if not self.external:
            try:
                zipfile.ZipFile(file, 'r', allowZip64=True)
            except zipfile.BadZipFile as e:
                from resources.libs.common import logging
                logging.log(e, level=xbmc.LOGERROR)
                self.progress_dialog.update(0, '[COLOR {0}]Unable to read zip file from current location.'.format(CONFIG.COLOR2) + '\n' + 'Copying file to packages')
                xbmcvfs.copy(file, packages)
                file = xbmc.translatePath(packages)
                self.progress_dialog.update(0, '\n' + 'Copying file to packages: Complete')
                zipfile.ZipFile(file, 'r', allowZip64=True)
        else:
            from resources.libs.downloader import Downloader
            Downloader().download(file, packages)

        self._prompt_for_wipe()

        self.progress_dialog.update(0, 'Installing External Backup' + '\n' + 'Please Wait')
        percent, errors, error = extract.all(file, loc)
        self._view_errors(percent, errors, error, file)

        CONFIG.set_setting('installed', 'true')
        CONFIG.set_setting('extract', percent)
        CONFIG.set_setting('errors', errors)

        if self.external:
            try:
                os.remove(file)
            except:
                pass

        #db.force_check_updates(over=True)

        tools.kill_kodi(
            msg='[COLOR {0}]Để thay đổi có hiệu lực bàn cần phải khởi động lại KODI.\nBạn có muốn tiếp tục?[/COLOR]'.format(
                CONFIG.COLOR2))
Example #14
0
    def _from_file(self, file, loc):
        from resources.libs import db
        from resources.libs import extract

        display = os.path.split(file)
        filename = display[1]
        packages = os.path.join(CONFIG.PACKAGES, filename)

        if not self.external:
            try:
                zipfile.ZipFile(file, 'r', allowZip64=True)
            except zipfile.BadZipFile as e:
                from resources.libs.common import logging
                logging.log(e, level=xbmc.LOGERROR)
                self.progress_dialog.update(0, '[COLOR {0}]Incapaz de ler o arquivo zip da localização atual. '.format(CONFIG.COLOR2) + '\n' + 'Copiando arquivo para pacotes')
                xbmcvfs.copy(file, packages)
                file = xbmcvfs.translatePath(packages)
                self.progress_dialog.update(0, '\n' + 'Copiando arquivo para pacotes: Completo')
                zipfile.ZipFile(file, 'r', allowZip64=True)
        else:
            from resources.libs.downloader import Downloader
            Downloader().download(file, packages)

        self._prompt_for_wipe()

        self.progress_dialog.update(0, 'Instalando Backup Externo' + '\n' + 'Por favor, aguarde...')
        percent, errors, error = extract.all(file, loc)
        self._view_errors(percent, errors, error, file)

        CONFIG.set_setting('installed', 'true')
        CONFIG.set_setting('extract', percent)
        CONFIG.set_setting('errors', errors)

        if self.external:
            try:
                os.remove(file)
            except:
                pass

        db.force_check_updates(over=True)

        tools.kill_kodi(
            msg='[COLOR {0}]Para salvar as alterações, o Kodi precisa ser fechado à força. Você gostaria de continuar?[/COLOR]'.format(
                CONFIG.COLOR2))
Example #15
0
def wizard(name, url, description):
    ################## New code ###################################
    zipname = name.replace('\\', '').replace('/', '').replace(':', '').replace(
        '*',
        '').replace('?',
                    '').replace('"',
                                '').replace('<',
                                            '').replace('>',
                                                        '').replace('|', '')
    if not os.path.exists(PACKAGES): os.makedirs(PACKAGES)
    DP.create(ADDONTITLE, '[B]Đang Tải:[/B] %s' % (name), '',
              'Chờ Chút Nhé...')
    lib = os.path.join(PACKAGES, '%s.zip' % zipname)
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, DP)
    xbmc.sleep(500)
    title = '[B]Đang cài đặt:[/B] %s' % (name)
    DP.update(0, title, '', 'Chờ Chút Nhé...')
    percent, errors, error = extract.all(lib, HOME, DP, title=title)
    if int(float(percent)) > 0:

        wiz.log('INSTALLED %s: [ERRORS:%s]' % (percent, errors))
        try:
            os.remove(lib)
        except:
            pass
        if int(float(errors)) > 0:
            yes = DIALOG.yesno(
                ADDONTITLE,
                '[COLOR %s][COLOR %s]%s[/COLOR]' % (COLOR2, COLOR1, name),
                'Đã hoàn thành: [COLOR %s]%s%s[/COLOR] [Lỗi:[COLOR %s]%s[/COLOR]]'
                % (COLOR1, percent, '%', COLOR1, errors),
                'Bạn có muốn xem thống kê lỗi?[/COLOR]',
                nolabel='[B][COLOR red]Không cần[/COLOR][/B]',
                yeslabel='[B][COLOR green]Xem ngay[/COLOR][/B]')
            if yes:
                if isinstance(errors, unicode):
                    error = error.encode('utf-8')
                wiz.TextBox(ADDONTITLE, error)
    DP.close()
Example #16
0
else: wiz.log('[AUTO CLEAN UP: off]')

if AUTOINSTALL == 'Yes' and not os.path.exists(os.path.join(ADDONS, REPOID)):
	workingxml = wiz.workingURL(REPOADDONXML)
	if workingxml == True:
		link    = wiz.openURL(REPOADDONXML).replace('\n','').replace('\r','').replace('\t','')
		match   = re.compile('<addon.+?id="%s".+?ersion="(.+?)".+?>' % REPOID).findall(link)
		installzip = '%s-%s.zip' % (REPOID, match[0])
		workingrepo = wiz.workingURL(REPOZIPURL+installzip)
		if workingrepo == True:
			if not os.path.exists(PACKAGES): os.makedirs(PACKAGES)
			lib=os.path.join(PACKAGES, installzip)
			try: os.remove(lib)
			except: pass
			downloader.download(REPOZIPURL+installzip,lib)
			extract.all(lib, ADDONS)
			f = open(os.path.join(ADDONS, REPOID, 'addon.xml'), mode='r').read()
			match = re.compile('<addon.+?id="%s".+?ame="(.+?)".+?>' % REPOID).findall(f)
			wiz.LogNotify(match[0], "Add-on updated", icon=os.path.join(ADDONS, REPOID, 'icon.png'))
			xbmc.sleep(1000)
			xbmc.executebuiltin('UpdateAddonRepos()')
			xbmc.executebuiltin('UpdateLocalAddons()')
			xbmc.sleep(1000)
		else: 
			wiz.LogNotify("Repo Install Error", "Invalid url for zip!")
			wiz.log("Error: Was unable to create a working url for repository.")
	else: 
		wiz.LogNotify("Repo Install Error", "Invalid addon.xml file!")
		wiz.log("Error: Unable to read the addon.xml file.")

if AUTOUPDATE == 'Yes':
Example #17
0
def import_save_data():
    dialog = xbmcgui.Dialog()

    TEMP = os.path.join(CONFIG.PLUGIN_DATA, 'temp')
    if not os.path.exists(TEMP):
        os.makedirs(TEMP)
    source = dialog.browse(
        1, '[COLOR {0}]Selecione a localização do SaveData.zip[/COLOR]'.format(
            CONFIG.COLOR2), 'files', '.zip', False, False, CONFIG.HOME)
    if not source.endswith('.zip'):
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]Erro de importação de dados![/COLOR]".format(
                CONFIG.COLOR2))
        return
    source = xbmcvfs.translatePath(source)
    tempfile = xbmcvfs.translatePath(
        os.path.join(CONFIG.MYBUILDS, 'SaveData.zip'))
    if not tempfile == source:
        goto = xbmcvfs.copy(source, tempfile)

    from resources.libs import extract
    if not extract.all(xbmcvfs.translatePath(tempfile), TEMP):
        logging.log("Erro ao tentar extrair o arquivo zip!")
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]Erro de importação de dados![/COLOR]".format(
                CONFIG.COLOR2))
        return

    trakt = os.path.join(TEMP, 'trakt')
    login = os.path.join(TEMP, 'login')
    debrid = os.path.join(TEMP, 'debrid')
    super = os.path.join(TEMP, 'plugin.program.super.favourites')
    xmls = os.path.join(TEMP, 'xmls')

    x = 0
    overwrite = dialog.yesno(
        CONFIG.ADDONTITLE,
        "[COLOR {0}]Você prefere que substituamos todos os arquivos de dados salvos ou solicitemos cada arquivo que está sendo importado?[/COLOR]"
        .format(CONFIG.COLOR2),
        yeslabel="[B][COLOR springgreen]Sobrescreva tudo[/COLOR][/B]",
        nolabel="[B][COLOR red]Não pergunte[/COLOR][/B]")

    if os.path.exists(trakt):
        from resources.libs import traktit

        x += 1
        files = os.listdir(trakt)
        if not os.path.exists(CONFIG.TRAKTFOLD):
            os.makedirs(CONFIG.TRAKTFOLD)
        for item in files:
            old = os.path.join(CONFIG.TRAKTFOLD, item)
            temp = os.path.join(trakt, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}]Você gostaria de substituir o atual [COLOR {1}]{2}[/COLOR] file?"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                            yeslabel=
                            "[B][COLOR springgreen]Sim Substituir[/COLOR][/B]",
                            nolabel="[B][COLOR red]Não, pular[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        traktit.import_list('all')
        traktit.trakt_it('restore', 'all')
    if os.path.exists(login):
        from resources.libs import loginit

        x += 1
        files = os.listdir(login)
        if not os.path.exists(CONFIG.LOGINFOLD):
            os.makedirs(CONFIG.LOGINFOLD)
        for item in files:
            old = os.path.join(CONFIG.LOGINFOLD, item)
            temp = os.path.join(login, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}]Você gostaria de substituir o atual [COLOR {1}]{2}[/COLOR] arquivo?"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                            yeslabel=
                            "[B][COLOR springgreen]Sim Substituir[/COLOR][/B]",
                            nolabel="[B][COLOR red]Não, pular[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        loginit.import_list('all')
        loginit.login_it('restore', 'all')

    if os.path.exists(debrid):
        from resources.libs import debridit

        x += 1
        files = os.listdir(debrid)
        if not os.path.exists(CONFIG.DEBRIDFOLD):
            os.makedirs(CONFIG.DEBRIDFOLD)
        for item in files:
            old = os.path.join(CONFIG.DEBRIDFOLD, item)
            temp = os.path.join(debrid, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}]Você gostaria de substituir o atual [COLOR {1}]{2}[/COLOR] arquivo?"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                            yeslabel=
                            "[B][COLOR springgreen]Sim Trocar[/COLOR][/B]",
                            nolabel="[B][COLOR red]Não, pular[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        debridit.import_list('all')
        debridit.debrid_it('restore', 'all')
    if os.path.exists(xmls):
        x += 1
        for item in CONFIG.XMLS:
            old = os.path.join(CONFIG.USERDATA, item)
            new = os.path.join(xmls, item)
            if not os.path.exists(new): continue
            if os.path.exists(old):
                if not overwrite == 1:
                    if not dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}]Você gostaria de substituir o atual [COLOR {1}]{2}[/COLOR] arquivo?"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                            yeslabel=
                            "[B][COLOR springgreen]Sim Trocar[/COLOR][/B]",
                            nolabel="[B][COLOR red]Não, pular[/COLOR][/B]"):
                        continue
            os.remove(old)
            shutil.copy(new, old)
    if os.path.exists(super):
        x += 1
        old = os.path.join(CONFIG.ADDON_DATA,
                           'plugin.program.super.favourites')
        if os.path.exists(old):
            cont = dialog.yesno(
                CONFIG.ADDONTITLE,
                "[COLOR {0}]Você gostaria de substituir o atual [COLOR {1}]Super Favourites[/COLOR] addon_data pasta com a nova?"
                .format(CONFIG.COLOR2, CONFIG.COLOR1),
                yeslabel="[B][COLOR springgreen]Sim Trocar[/COLOR][/B]",
                nolabel="[B][COLOR red]Não, pular[/COLOR][/B]")
        else:
            cont = 1
        if cont == 1:
            tools.clean_house(old)
            tools.remove_folder(old)
            xbmcvfs.copy(super, old)
    tools.clean_house(TEMP)
    tools.remove_folder(TEMP)
    if not tempfile == source:
        xbmcvfs.delete(tempfile)
    if x == 0:
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]Save Data Import Failed[/COLOR]".format(CONFIG.COLOR2))
    else:
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]Save Data Import Complete[/COLOR]".format(
                CONFIG.COLOR2))
Example #18
0
    def install_skin(self, name, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs.common import logging
        from resources.libs import skin
        from resources.libs.common import tools
        if 78 - 78: O0.oO0o.II111iiii % OOooOOo
        O0oOoOOOoOO = xbmcgui.DialogProgress()
        if 49 - 49: Ii1I / OoO0O00.II111iiii
        oo0Ooo0 = tools.open_url(url, check=False)
        if 68 - 68: i11iIiiIii % I1ii11iIi11i + i11iIiiIii
        if not oo0Ooo0:
            logging.log_notify(
                "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.
                format(CONFIG.COLOR1, name, CONFIG.COLOR2))
            return
            if 31 - 31: II111iiii.I1IiiI
        if not os.path.exists(CONFIG.PACKAGES):
            os.makedirs(CONFIG.PACKAGES)
            if 1 - 1: Oo0Ooo / o0oOOo0O0Ooo % o0OO0 * Oo0ooO0oo0oO.i11iIiiIii
        O0oOoOOOoOO.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + '' + '\n' +
            '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
        if 2 - 2: I1ii11iIi11i * I11i - iIii1I11I1II1 + I1IiiI.oO0o % o0OO0
        Ii11Ii1I = url.split('/')
        O00oO = xbmc.makeLegalFilename(
            os.path.join(CONFIG.PACKAGES, Ii11Ii1I[-1]))
        try:
            os.remove(O00oO)
        except:
            pass
        Downloader().download(url, O00oO)
        I1 = '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, name)
        O0oOoOOOoOO.update(
            0, I1 + '\n' + '' + '\n' +
            '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
        OO00Oo, O0OOO0OOoO0O, O00Oo000ooO0 = extract.all(O00oO,
                                                         CONFIG.HOME,
                                                         title=I1)
        IiiIII111iI = db.grab_addons(O00oO)
        db.addon_database(IiiIII111iI, 1, True)
        O0oOoOOOoOO.close()
        logging.log_notify(
            "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
            '[COLOR {0}]{1}: Installed![/COLOR]'.format(CONFIG.COLOR2, name))
        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        for Oo0oOOo in IiiIII111iI:
            if Oo0oOOo.startswith('skin.') and not Oo0oOOo == 'skin.shortcuts':
                if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                    CONFIG.set_setting('defaultskinignore', 'true')
                skin.switch_to_skin(Oo0oOOo, 'Skin Installer')
        xbmc.executebuiltin('Container.Refresh()')


# Team KelTec Media'Play
def import_save_data():
    dialog = xbmcgui.Dialog()

    TEMP = os.path.join(CONFIG.PLUGIN_DATA, 'temp')
    if not os.path.exists(TEMP):
        os.makedirs(TEMP)
    source = dialog.browse(1, '[COLOR {0}]Select the location of the SaveData.zip[/COLOR]'.format(CONFIG.COLOR2),
                               'files', '.zip', False, False, CONFIG.HOME)
    if not source.endswith('.zip'):
        logging.log_notify(CONFIG.ADDONTITLE,
                           "[COLOR {0}]Import Data Error![/COLOR]".format(CONFIG.COLOR2))
        return
    source = xbmc.translatePath(source)
    tempfile = xbmc.translatePath(os.path.join(CONFIG.MYBUILDS, 'SaveData.zip'))
    if not tempfile == source:
        goto = xbmcvfs.copy(source, tempfile)

    from resources.libs import extract
    if not extract.all(xbmc.translatePath(tempfile), TEMP):
        logging.log("Error trying to extract the zip file!")
        logging.log_notify(CONFIG.ADDONTITLE,
                           "[COLOR {0}]Import Data Error![/COLOR]".format(CONFIG.COLOR2))
        return

    trakt = os.path.join(TEMP, 'trakt')
    login = os.path.join(TEMP, 'login')
    debrid = os.path.join(TEMP, 'debrid')
    super = os.path.join(TEMP, 'plugin.program.super.favourites')
    xmls = os.path.join(TEMP, 'xmls')

    x = 0
    overwrite = dialog.yesno(CONFIG.ADDONTITLE,
                                 "[COLOR {0}]Would you rather we overwrite all Save Data files or ask you for each file being imported?[/COLOR]".format(CONFIG.COLOR2),
                                 yeslabel="[B][COLOR springgreen]Overwrite All[/COLOR][/B]",
                                 nolabel="[B][COLOR red]No Ask[/COLOR][/B]")
    
    if os.path.exists(trakt):
        from resources.libs import traktit

        x += 1
        files = os.listdir(trakt)
        if not os.path.exists(CONFIG.TRAKTFOLD):
            os.makedirs(CONFIG.TRAKTFOLD)
        for item in files:
            old = os.path.join(CONFIG.TRAKTFOLD, item)
            temp = os.path.join(trakt, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(CONFIG.ADDONTITLE,
                                            "[COLOR {0}]Would you like replace the current [COLOR {1}]{2}[/COLOR] file?".format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                                            yeslabel="[B][COLOR springgreen]Yes Replace[/COLOR][/B]",
                                            nolabel="[B][COLOR red]No Skip[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        traktit.import_list('all')
        traktit.trakt_it('restore', 'all')
    if os.path.exists(login):
        from resources.libs import loginit

        x += 1
        files = os.listdir(login)
        if not os.path.exists(CONFIG.LOGINFOLD):
            os.makedirs(CONFIG.LOGINFOLD)
        for item in files:
            old = os.path.join(CONFIG.LOGINFOLD, item)
            temp = os.path.join(login, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(CONFIG.ADDONTITLE,
                                            "[COLOR {0}]Would you like replace the current [COLOR {1}]{2}[/COLOR] file?".format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                                            yeslabel="[B][COLOR springgreen]Yes Replace[/COLOR][/B]",
                                            nolabel="[B][COLOR red]No Skip[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        loginit.import_list('all')
        loginit.login_it('restore', 'all')
    
    if os.path.exists(debrid):
        from resources.libs import debridit

        x += 1
        files = os.listdir(debrid)
        if not os.path.exists(CONFIG.DEBRIDFOLD):
            os.makedirs(CONFIG.DEBRIDFOLD)
        for item in files:
            old = os.path.join(CONFIG.DEBRIDFOLD, item)
            temp = os.path.join(debrid, item)
            if os.path.exists(old):
                if overwrite == 1:
                    os.remove(old)
                else:
                    if not dialog.yesno(CONFIG.ADDONTITLE,
                                            "[COLOR {0}]Would you like replace the current [COLOR {1}]{2}[/COLOR] file?".format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                                            yeslabel="[B][COLOR springgreen]Yes Replace[/COLOR][/B]",
                                            nolabel="[B][COLOR red]No Skip[/COLOR][/B]"):
                        continue
                    else:
                        os.remove(old)
            shutil.copy(temp, old)
        debridit.import_list('all')
        debridit.debrid_it('restore', 'all')
    if os.path.exists(xmls):
        x += 1
        for item in CONFIG.XMLS:
            old = os.path.join(CONFIG.USERDATA, item)
            new = os.path.join(xmls, item)
            if not os.path.exists(new): continue
            if os.path.exists(old):
                if not overwrite == 1:
                    if not dialog.yesno(CONFIG.ADDONTITLE,
                                            "[COLOR {0}]Would you like replace the current [COLOR {1}]{2}[/COLOR] file?".format(CONFIG.COLOR2, CONFIG.COLOR1, item),
                                            yeslabel="[B][COLOR springgreen]Yes Replace[/COLOR][/B]",
                                            nolabel="[B][COLOR red]No Skip[/COLOR][/B]"):
                        continue
            os.remove(old)
            shutil.copy(new, old)
    if os.path.exists(super):
        x += 1
        old = os.path.join(CONFIG.ADDON_DATA, 'plugin.program.super.favourites')
        if os.path.exists(old):
            cont = dialog.yesno(CONFIG.ADDONTITLE,
                                    "[COLOR {0}]Would you like replace the current [COLOR {1}]Super Favourites[/COLOR] addon_data folder with the new one?".format(CONFIG.COLOR2, CONFIG.COLOR1),
                                    yeslabel="[B][COLOR springgreen]Yes Replace[/COLOR][/B]",
                                    nolabel="[B][COLOR red]No Skip[/COLOR][/B]")
        else:
            cont = 1
        if cont == 1:
            tools.clean_house(old)
            tools.remove_folder(old)
            xbmcvfs.copy(super, old)
    tools.clean_house(TEMP)
    tools.remove_folder(TEMP)
    if not tempfile == source:
        xbmcvfs.delete(tempfile)
    if x == 0:
        logging.log_notify(CONFIG.ADDONTITLE,
                           "[COLOR {0}]Save Data Import Failed[/COLOR]".format(CONFIG.COLOR2))
    else:
        logging.log_notify(CONFIG.ADDONTITLE,
                           "[COLOR {0}]Save Data Import Complete[/COLOR]".format(CONFIG.COLOR2))
Example #20
0
def SDFix():

    SPORTS_DEVIL_FOLDER = xbmc.translatePath(
        os.path.join('special://home/addons', 'plugin.video.SportsDevil'))
    SPORTS_DEVIL_DATA = xbmc.translatePath(
        'special://userdata/addon_data/plugin.video.SportsDevil')
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))

    choice = xbmcgui.Dialog().yesno(
        ADDONTITLE,
        'This option will remove all traces of Sports Devil (If Installed) and install a clean version.',
        'Would you like to continue?',
        yeslabel='[B][COLOR springgreen]YES[/COLOR][/B]',
        nolabel='[B][COLOR snow]NO[/COLOR][/B]')
    if choice == 0:
        sys.exit(1)
    dialog = xbmcgui.Dialog()
    if os.path.exists(SPORTS_DEVIL_FOLDER):
        try:
            shutil.rmtree(SPORTS_DEVIL_FOLDER)
        except:
            pass
    if os.path.exists(SPORTS_DEVIL_DATA):
        try:
            shutil.rmtree(SPORTS_DEVIL_DATA)
        except:
            pass
    purgePath = xbmc.translatePath('special://home/addons/packages')
    for root, dirs, files in os.walk(purgePath):
        file_count = 0
        file_count += len(files)
    for root, dirs, files in os.walk(purgePath):
        file_count = 0
        file_count += len(files)
        if file_count > 0:
            for f in files:
                os.unlink(os.path.join(root, f))
            for d in dirs:
                shutil.rmtree(os.path.join(root, d))

    if not os.path.exists(path):
        os.makedirs(path)

    url = ('http://repo.tantrumtv.com/dm/patches/plugin.video.SportsDevil.zip')
    dp = xbmcgui.DialogProgress()
    dp.create(ADDONTITLE, "", "", "Installing Sports Devil")
    lib = os.path.join(path, 'addon.zip')

    try:
        os.remove(lib)
    except:
        pass

    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons'))
    time.sleep(2)
    dp.update(0, "", "Extracting Zip Please Wait", "")
    extract.all(lib, addonfolder, dp)
    try:
        os.remove(lib)
    except:
        pass
    xbmc.executebuiltin("ActivateWindow(busydialog)")
    xbmc.executebuiltin("UpdateAddonRepos")
    xbmc.executebuiltin("UpdateLocalAddons")
    xbmc.executebuiltin("Dialog.Close(busydialog)")

    dialog.ok(
        ADDONTITLE,
        "[COLOR snow]The Sports Devil plugin should now be fixed and working correctly. If you have any issues please turn AUTO UPDATE OFF on Sports Devil and run this fix again.[/COLOR]"
    )
    quit()
Example #21
0
    def theme(self, name, theme='', over=False):
        installtheme = False

        if not theme:
            themefile = check.check_build(name, 'theme')

            response = tools.open_url(themefile, check=True)
            if response:
                from resources.libs.gui.build_menu import BuildMenu
                themes = BuildMenu().theme_count(name, False)
                if len(themes) > 0:
                    if self.dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}][B]La Build [COLOR {1}]{2}[/COLOR] viene con [COLOR {3}]{4}[/COLOR] Parches diferentes[/B]"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, name,
                                    CONFIG.COLOR1, len(themes)) + '\n\n' +
                            "Le gustaria instalar uno ahora?[/COLOR]",
                            yeslabel=
                            "[B][COLOR cyan]Instalar Parche[/COLOR][/B]",
                            nolabel="[B][COLOR red]Cancelar Parche[/COLOR][/B]"
                    ):
                        logging.log("Lista de Parches: {0}".format(
                            str(themes)))
                        ret = self.dialog.select(CONFIG.ADDONTITLE, themes)
                        logging.log(
                            "[B]Selecciona un Parche para Instalar:[/B] {0}".
                            format(ret))
                        if not ret == -1:
                            theme = themes[ret]
                            installtheme = True
                        else:
                            logging.log_notify(
                                CONFIG.ADDONTITLE,
                                '[COLOR {0}]Instalación:[/COLOR] [COLOR gold]Cancelado![/COLOR]'
                                .format(CONFIG.COLOR2))
                            return
                    else:
                        logging.log_notify(
                            CONFIG.ADDONTITLE,
                            '[COLOR {0}]Instalación Parche:[/COLOR] [COLOR gold]Cancelado![/COLOR]'
                            .format(CONFIG.COLOR2))
                        return
            else:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Instalación Parche:[/COLOR] [COLOR gold]Nada Encontrado![/COLOR]'
                    .format(CONFIG.COLOR2))
        else:
            installtheme = self.dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Te gustaría instalar uno de los Parches que hay en:[/B]'
                .format(CONFIG.COLOR2) + ' \n' +
                '[COLOR dodgerblue][B]PARCHES MATRIX[/B][/COLOR]'.format(
                    CONFIG.COLOR1, theme) + '\n' +
                '[B]para [COLOR {0}]{1} v{2}[/COLOR]?[/B][/COLOR]'.format(
                    CONFIG.COLOR1, name, check.check_build(name, 'version')),
                yeslabel="[B][COLOR cyan]Instalar Parche[/COLOR][/B]",
                nolabel="[B][COLOR red]Cancelar Parche[/COLOR][/B]")

        if installtheme:
            themezip = check.check_theme(name, theme, 'url')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            response = tools.open_url(themezip, check=True)
            if not response:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Instalación Parche:[/COLOR] [COLOR gold]Url Zip Inválido![/COLOR]'
                    .format(CONFIG.COLOR2))
                return False

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1, zipname) + ' \n' +
                'Espere por Favor')

            lib = os.path.join(CONFIG.PACKAGES, '{0}.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(themezip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass
                return
            self.dialogProgress.update(0, '\n' + "Instalando {0}".format(name))
            from resources.libs import skin
            from resources.libs import test
            title = '[COLOR {0}][B]Instalando Parche:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, theme)
            self.dialogProgress.update(0, title + '\n' + 'Espere por Favor')
            percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)
            CONFIG.set_setting('buildtheme', theme)
            logging.log('INSTALADO {0}: [ERRORES:{1}]'.format(percent, errors))
            self.dialogProgress.close()
            installed = db.grab_addons(lib)
            db.addon_database(installed, 1, True)
            xbmc.executebuiltin("ReloadSkin()")
            xbmc.sleep(1000)
            xbmc.executebuiltin("Container.Refresh()")
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Instalación Parche:[/COLOR] [COLOR gold]Cancelado![/COLOR]'
                .format(CONFIG.COLOR2))
Example #22
0
    def build(self, name, over=False):
        # if action == 'normal':
        # if CONFIG.KEEPTRAKT == 'true':
        # from resources.libs import traktit
        # traktit.auto_update('all')
        # CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPDEBRID == 'true':
        # from resources.libs import debridit
        # debridit.auto_update('all')
        # CONFIG.set_setting('debridnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPLOGIN == 'true':
        # from resources.libs import loginit
        # loginit.auto_update('all')
        # CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))

        temp_kodiv = int(CONFIG.KODIV)
        buildv = int(float(check.check_build(name, 'kodi')))

        if not temp_kodiv == buildv:
            warning = True
        else:
            warning = False

        if warning:
            yes_pressed = self.dialog.yesno(
                "{0} - [COLOR red]WARNING!![/COLOR]".format(CONFIG.ADDONTITLE),
                '[COLOR {0}]There is a chance that the skin will not appear correctly'
                .format(CONFIG.COLOR2) + '\n' +
                'When installing a {0} build on a Kodi {1} install'.format(
                    check.check_build(name, 'kodi'), CONFIG.KODIV) + '\n' +
                'Would you still like to install: [COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'
                .format(CONFIG.COLOR1, name, check.check_build(
                    name, 'version')),
                nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]Yes, Install[/COLOR][/B]')
        else:
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Would you like to Download and Install: '.
                    format(CONFIG.COLOR2) +
                    '[COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'.format(
                        CONFIG.COLOR1, name, check.check_build(
                            name, 'version')),
                    nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                    yeslabel='[B][COLOR springgreen]Yes, Install[/COLOR][/B]')
        if yes_pressed:
            CONFIG.clear_setting('build')
            buildzip = check.check_build(name, 'url')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Downloading:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1, name,
                        check.check_build(name, 'version')) + '\n' +
                'Please Wait')

            lib = os.path.join(CONFIG.MYBUILDS, '{0}.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(buildzip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass

                return

            yes_fresh = self.dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][COLOR {1}]Do you wish to erase all data before installing?[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1),
                nolabel='[B][COLOR red]No Thanks[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]Fresh Install[/COLOR][/B]')
            if yes_fresh:
                install.wipe()

            skin.look_and_feel_data('save')

            title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, name,
                check.check_build(name, 'version'))
            self.dialogProgress.update(0, title + '\n' + 'Please Wait')
            percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)

            skin.skin_to_default('Build Install')

            if int(float(percent)) > 0:
                db.fix_metas()
                CONFIG.set_setting('buildname', name)
                CONFIG.set_setting('buildversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting('buildtheme', '')
                CONFIG.set_setting('latestversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting(
                    'nextbuildcheck',
                    tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
                CONFIG.set_setting('installed', 'true')
                CONFIG.set_setting('extract', percent)
                CONFIG.set_setting('errors', errors)
                logging.log('INSTALLED {0}: [ERRORS:{1}]'.format(
                    percent, errors))

                try:
                    os.remove(lib)
                except:
                    pass

                if int(float(errors)) > 0:
                    yes_pressed = self.dialog.yesno(
                        CONFIG.ADDONTITLE,
                        '[COLOR {0}][COLOR {1}]{2} v{3}[/COLOR]'.format(
                            CONFIG.COLOR2, CONFIG.COLOR1, name,
                            check.check_build(name, 'version')) + '\n' +
                        'Completed: [COLOR {0}]{1}{2}[/COLOR] [Errors:[COLOR {3}]{4}[/COLOR]]'
                        .format(CONFIG.COLOR1, percent, '%', CONFIG.COLOR1,
                                errors) + '\n' +
                        'Would you like to view the errors?[/COLOR]',
                        nolabel='[B][COLOR red]No Thanks[/COLOR][/B]',
                        yeslabel='[B][COLOR springgreen]View Errors[/COLOR][/B]'
                    )
                    if yes_pressed:
                        from resources.libs.gui import window
                        window.show_text_box("Viewing Build Install Errors",
                                             error)
                self.dialogProgress.close()

                from resources.libs.gui.build_menu import BuildMenu
                #themecount = BuildMenu().theme_count(name)

                #if themecount > 0:
                #self.theme(name, 'theme')

                db.addon_database(CONFIG.ADDON_ID, 1)
                #db.force_check_updates(over=True)

                self.dialog.ok(
                    CONFIG.ADDONTITLE,
                    "[COLOR {0}]To save changes you now need to force close Kodi, Press OK to force close Kodi[/COLOR]"
                    .format(CONFIG.COLOR2))
                tools.kill_kodi(over=True)
            else:
                from resources.libs.gui import window
                window.show_text_box("Viewing Build Install Errors", error)
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Build Install: Cancelled![/COLOR]'.format(
                    CONFIG.COLOR2))
Example #23
0
def wizard_update():
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Hay una nueva versión del {1}!'.format(
                    CONFIG.COLOR2, CONFIG.ADDONTITLE),
                'Te gustaria descargar [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.
                format(CONFIG.COLOR1, ver),
                nolabel='[B][COLOR red]Recuérdame más tarde[/COLOR][/B]',
                yeslabel="[B][COLOR springgreen]ACTUALIZAR WIZARD[/COLOR][/B]")
            if yes:
                from resources.libs import db
                from resources.libs.common import tools

                logging.log(
                    "[Auto Update Wizard] INSTALANDO WIZARD v{0}".format(ver))
                progress_dialog.create(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]DESCARGANDO ACTUALIZACION...'.format(
                        CONFIG.COLOR2), '', 'Please Wait[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES,
                                   '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(
                    0, "",
                    "INSTALANDO {0} ACTUALIZACION".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                db.force_check_updates(auto=True, over=True)
                xbmc.sleep(1000)
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Add-on ACTLUALIZADO[/COLOR]'.format(
                        CONFIG.COLOR2))
                logging.log(
                    "[Auto Update Wizard] WIZARD ACTUALIZADO v{0}".format(ver))
                tools.remove_file(
                    os.path.join(CONFIG.ADDON_DATA, 'settings.xml'))
                window.show_save_data_settings()
            else:
                logging.log(
                    "[Auto Update Wizard] IGNORAR INSTALACION DEL WIZARD: {0}".
                    format(ver))
        else:
            logging.log(
                "[Auto Update Wizard] No hay nueva versión v{0}".format(ver))
    else:
        logging.log(
            "[Auto Update Wizard] La URL del archivo del WIZARD no es válida: {0}"
            .format(CONFIG.BUILDFILE))
Example #24
0
def wizard_update():
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Hay una nueva versión de{1}!'.format(
                    CONFIG.COLOR2, CONFIG.ADDONTITLE) + '\n' +
                '¿Quieres descargar la [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.
                format(CONFIG.COLOR1, ver),
                nolabel='[B][COLOR red]Recordar Más tarde[/COLOR][/B]',
                yeslabel="[B][COLOR cyan]Actualizar[/COLOR][/B]")
            if yes:
                from resources.libs import db
                from resources.libs.common import tools

                progress_dialog.create(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Descargando Actualización...'.format(
                        CONFIG.COLOR2) + '\n' + '' + '\n' +
                    'Espere por favor[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES,
                                   '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(
                    0, '\n' +
                    "Instalando {0} Actualización".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                db.force_check_updates(auto=True, over=True)
                xbmc.sleep(1000)
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Add-on actualizado[/COLOR]'.format(
                        CONFIG.COLOR2))
                logging.log(
                    "[Auto Update Wizard] Wizard actualizado a la v{0}".format(
                        ver))
                tools.remove_file(
                    os.path.join(CONFIG.ADDON_DATA, 'settings.xml'))
                window.show_save_data_settings()
            else:
                logging.log(
                    "[Auto Update Wizard] Instalación del Nuevo Wizard Ignorada: {0}"
                    .format(ver))
        else:
            logging.log(
                "[Auto Update Wizard] No hay Nueva Versión v{0}".format(ver))
    else:
        logging.log(
            "[Auto Update Wizard] URL del Archivo del Wizard no válida: {0}".
            format(CONFIG.BUILDFILE))
Example #25
0
 def install_addon_from_url(self, plugin, url):
     from resources.libs.downloader import Downloader
     from resources.libs import db
     from resources.libs import extract
     from resources.libs import skin
     if 50 - 50: I1IiiI
     oo0Ooo0 = tools.open_url(url, check=True)
     if 34 - 34: I1IiiI * II111iiii % o0OO0 * OoOoOO00 - I1IiiI
     if not oo0Ooo0:
         logging.log_notify(
             "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
             '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.
             format(CONFIG.COLOR1, plugin, CONFIG.COLOR2))
         return
         if 33 - 33: o0oOOo0O0Ooo + OOooOOo * OoO0O00 - Oo0Ooo / oO0o % Ii1I
     tools.ensure_folders(CONFIG.PACKAGES)
     if 21 - 21: OoO0O00 * iIii1I11I1II1 % oO0o * i1IIi
     self.progress_dialog.create(
         CONFIG.ADDONTITLE,
         '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
         format(CONFIG.COLOR2, CONFIG.COLOR1, plugin) + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     Ii11Ii1I = url.split('/')
     O00oO = os.path.join(CONFIG.PACKAGES, Ii11Ii1I[-1])
     if 39 - 39:
         Oo0ooO0oo0oO - II111iiii * OoO0O00 % o0oOOo0O0Ooo * II111iiii % II111iiii
     try:
         os.remove(O00oO)
     except:
         pass
         if 59 - 59:
             iIii1I11I1II1 + I1IiiI - o0oOOo0O0Ooo - I1IiiI + OOooOOo / I1ii11iIi11i
     Downloader().download(url, O00oO)
     I1 = '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
         CONFIG.COLOR2, CONFIG.COLOR1, plugin)
     self.progress_dialog.update(
         0, I1 + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     OO00Oo, O0OOO0OOoO0O, O00Oo000ooO0 = extract.all(O00oO,
                                                      CONFIG.ADDONS,
                                                      title=I1)
     self.progress_dialog.update(
         0, I1 + '\n' + '' + '\n' +
         '[COLOR {0}]Baixando Dependencies[/COLOR]'.format(CONFIG.COLOR2))
     IiiIII111iI(plugin)
     OoO0O00IIiII = db.grab_addons(O00oO)
     logging.log(str(OoO0O00IIiII))
     db.addon_database(OoO0O00IIiII, 1, True)
     self.install_dependency(plugin)
     self.progress_dialog.close()
     if 80 - 80: Oo0ooO0oo0oO.oO0o
     xbmc.executebuiltin('UpdateAddonRepos()')
     xbmc.executebuiltin('UpdateLocalAddons()')
     xbmc.executebuiltin('Container.Refresh()')
     if 25 - 25: OoOoOO00.II111iiii / o0OO0.OOooOOo * OoO0O00.I1IiiI
     for Oo0oOOo in OoO0O00IIiII:
         if Oo0oOOo.startswith('skin.') and not Oo0oOOo == 'skin.shortcuts':
             if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                 CONFIG.set_setting('defaultskinignore', 'true')
             skin.switch_to_skin(Oo0oOOo, 'Skin Installer')
             if 58 - 58: II111iiii * OOooOOo * I1ii11iIi11i / OOooOOo
Example #26
0
    def build(self, name, over=False):
        # if action == 'normal':
        # if CONFIG.KEEPTRAKT == 'true':
        # from resources.libs import traktit
        # traktit.auto_update('all')
        # CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPDEBRID == 'true':
        # from resources.libs import debridit
        # debridit.auto_update('all')
        # CONFIG.set_setting('debridnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPLOGIN == 'true':
        # from resources.libs import loginit
        # loginit.auto_update('all')
        # CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))

        temp_kodiv = int(CONFIG.KODIV)
        buildv = int(float(check.check_build(name, 'kodi')))

        if not temp_kodiv == buildv:
            warning = True
        else:
            warning = False

        if warning:
            yes_pressed = self.dialog.yesno(
                "{0} - [COLOR red]ADVERTENCIA!![/COLOR]".format(
                    CONFIG.ADDONTITLE),
                '[COLOR {0}]Existe la posibilidad de que el Skin no se vea correctamente'
                .format(CONFIG.COLOR2) + '\n' +
                'Al instalar una {0} build en un Kodi {1} instalado'.format(
                    check.check_build(name, 'kodi'), CONFIG.KODIV) + '\n' +
                'Todavia te gustaria instalar: [COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'
                .format(CONFIG.COLOR1, name, check.check_build(
                    name, 'version')),
                nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]Yes, Install[/COLOR][/B]')
        else:
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}][B]La Instalación Sobreescribirá los datos de su Kodi Actual ![/B] '
                    .format(CONFIG.COLOR2) + '\n' +
                    '[COLOR {0}]Le gustaria Descargar e Instalar: '.format(
                        CONFIG.COLOR2) +
                    '[COLOR {0}]{1} v{2} [/COLOR]?[/COLOR]'.format(
                        CONFIG.COLOR1, name, check.check_build(
                            name, 'version')),
                    nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]',
                    yeslabel='[B][COLOR springgreen]Si, Instalar[/COLOR][/B]')
        if yes_pressed:
            CONFIG.clear_setting('build')
            buildzip = check.check_build(name, 'url')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1, name,
                        check.check_build(name, 'version')) + '\n' +
                'Espere por Favor')

            lib = os.path.join(CONFIG.MYBUILDS, '{0}.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(buildzip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass

                return

            install.wipe()

            skin.look_and_feel_data('save')

            title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, name,
                check.check_build(name, 'version'))
            self.dialogProgress.update(0, title + '\n' + 'Espere por Favor')
            percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)

            skin.skin_to_default('Instalar Build')

            if int(float(percent)) > 0:
                db.fix_metas()
                CONFIG.set_setting('buildname', name)
                CONFIG.set_setting('buildversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting('buildtheme', '')
                CONFIG.set_setting('latestversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting(
                    'nextbuildcheck',
                    tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
                CONFIG.set_setting('installed', 'true')
                CONFIG.set_setting('extract', percent)
                CONFIG.set_setting('errors', errors)
                logging.log('INSTALADO {0}: [ERRORES:{1}]'.format(
                    percent, errors))

                try:
                    os.remove(lib)
                except:
                    pass

                if int(float(errors)) > 0:
                    yes_pressed = self.dialog.yesno(
                        CONFIG.ADDONTITLE,
                        '[COLOR {0}][COLOR {1}]{2} v{3}[/COLOR]'.format(
                            CONFIG.COLOR2, CONFIG.COLOR1, name,
                            check.check_build(name, 'version')) + '\n' +
                        'Completado: [COLOR {0}]{1}{2}[/COLOR] [Errores:[COLOR {3}]{4}[/COLOR]]'
                        .format(CONFIG.COLOR1, percent, '%', CONFIG.COLOR1,
                                errors) + '\n' +
                        'Le gustaria ver los errores?[/COLOR]',
                        nolabel='[B][COLOR red]No, Gracias[/COLOR][/B]',
                        yeslabel='[B][COLOR springgreen]Ver Errores[/COLOR][/B]'
                    )
                    if yes_pressed:
                        from resources.libs.gui import window
                        window.show_text_box(
                            "Visualizacion de Errores de Instalacion de la Build",
                            error)
                self.dialogProgress.close()

                from resources.libs.gui.build_menu import BuildMenu
                themecount = BuildMenu().theme_count(name)

                if themecount > 0:
                    self.theme(name)

                db.addon_database(CONFIG.ADDON_ID, 1)
                db.force_check_updates(over=True)
                if os.path.exists(os.path.join(CONFIG.USERDATA, '.enableall')):
                    CONFIG.set_setting('enable_all', 'true')

                self.dialog.ok(
                    CONFIG.ADDONTITLE,
                    "[COLOR {0}]Para guardar los cambios, ahora necesita Forzar el Cierre de Kodi. \nPresione [B]OK[/B] para Forzar el Cierre de Kodi.[/COLOR]"
                    .format(CONFIG.COLOR2))
                tools.kill_kodi(over=True)
            else:
                from resources.libs.gui import window
                window.show_text_box(
                    "Visualizacion de Errores de Instalacion de la Build",
                    error)
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Instalacion Build:[/COLOR] [COLOR gold]Cancelado![/COLOR]'
                .format(CONFIG.COLOR2))
Example #27
0
def auto_install_repo():
    if not os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        response = tools.open_url(CONFIG.REPOADDONXML)

        if response:
            from xml.etree import ElementTree
            
            root = ElementTree.fromstring(response.text)
            repoaddon = root.findall('addon')
            repoversion = [tag.get('version') for tag in repoaddon if tag.get('id') == CONFIG.REPOID]
            
            if repoversion:
                installzip = '{0}-{1}.zip'.format(CONFIG.REPOID, repoversion[0])
                url = CONFIG.REPOZIPURL + installzip
                repo_response = tools.open_url(url, check=True)

                if repo_response:
                    progress_dialog = xbmcgui.DialogProgress()
                    
                    progress_dialog.create(CONFIG.ADDONTITLE, 'Downloading Repo...' + '\n' + 'Please Wait')
                    tools.ensure_folders(CONFIG.PACKAGES)
                    lib = os.path.join(CONFIG.PACKAGES, installzip)

                    # Remove the old zip if there is one
                    tools.remove_file(lib)

                    from resources.libs.downloader import Downloader
                    from resources.libs import extract
                    Downloader().download(url, lib)
                    extract.all(lib, CONFIG.ADDONS)

                    try:
                        repoxml = os.path.join(CONFIG.ADDONS, CONFIG.REPOID, 'addon.xml')
                        root = ElementTree.parse(repoxml).getroot()
                        reponame = root.get('name')
                        
                        logging.log_notify("{1}".format(CONFIG.COLOR1, reponame),
                                           "[COLOR {0}]Add-on updated[/COLOR]".format(CONFIG.COLOR2),
                                           icon=os.path.join(CONFIG.ADDONS, CONFIG.REPOID, 'icon.png'))
                                           
                    except Exception as e:
                        logging.log(str(e), level=xbmc.LOGERROR)

                    # Add wizard to add-on database
                    db.addon_database(CONFIG.REPOID, 1)

                    progress_dialog.close()
                    xbmc.sleep(500)

                    logging.log("[Auto Install Repo] Successfully Installed", level=xbmc.LOGINFO)
                else:
                    logging.log_notify("[COLOR {0}]Repo Install Error[/COLOR]".format(CONFIG.COLOR1),
                                       "[COLOR {0}]Invalid URL for zip![/COLOR]".format(CONFIG.COLOR2))
                    logging.log("[Auto Install Repo] Was unable to create a working URL for repository. {0}".format(
                        url), level=xbmc.LOGERROR)
            else:
                logging.log("Invalid URL for Repo zip", level=xbmc.LOGERROR)
        else:
            logging.log_notify("[COLOR {0}]Repo Install Error[/COLOR]".format(CONFIG.COLOR1),
                               "[COLOR {0}]Invalid addon.xml file![/COLOR]".format(CONFIG.COLOR2))
            logging.log("[Auto Install Repo] Unable to read the addon.xml file.", level=xbmc.LOGERROR)
    elif not CONFIG.AUTOINSTALL == 'Yes':
        logging.log("[Auto Install Repo] Not Enabled", level=xbmc.LOGINFO)
    elif os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        logging.log("[Auto Install Repo] Repository already installed")
Example #28
0
    def theme(self, name, theme, over=False):
        installtheme = False

        if not theme:
            themefile = check.check_build(name, 'theme')

            response = tools.open_url(themefile, check=True)
            if response:
                from resources.libs.gui.build_menu import BuildMenu
                themes = BuildMenu().theme_count(name, False)
                if len(themes) > 0:
                    if self.dialog.yesno(
                            CONFIG.ADDONTITLE,
                            "[COLOR {0}]The Build [COLOR {1}]{2}[/COLOR] comes with [COLOR {3}]{4}[/COLOR] different themes"
                            .format(CONFIG.COLOR2, CONFIG.COLOR1, name,
                                    CONFIG.COLOR1, len(themes)) + '\n' +
                            "Would you like to install one now?[/COLOR]",
                            yeslabel=
                            "[B][COLOR springgreen]Install Theme[/COLOR][/B]",
                            nolabel="[B][COLOR red]Cancel Themes[/COLOR][/B]"):
                        logging.log("Theme List: {0}".format(str(themes)))
                        ret = self.dialog.select(CONFIG.ADDONTITLE, themes)
                        logging.log("Theme install selected: {0}".format(ret))
                        if not ret == -1:
                            theme = themes[ret]
                            installtheme = True
                        else:
                            logging.log_notify(
                                CONFIG.ADDONTITLE,
                                '[COLOR {0}]Theme Install: Cancelled![/COLOR]'.
                                format(CONFIG.COLOR2))
                            return
                    else:
                        logging.log_notify(
                            CONFIG.ADDONTITLE,
                            '[COLOR {0}]Theme Install: Cancelled![/COLOR]'.
                            format(CONFIG.COLOR2))
                        return
            else:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Theme Install: None Found![/COLOR]'.format(
                        CONFIG.COLOR2))
        else:
            installtheme = self.dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Would you like to install the theme:'.format(
                    CONFIG.COLOR2) + ' \n' +
                '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, theme) + '\n' +
                'for [COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'.format(
                    CONFIG.COLOR1, name, check.check_build(name, 'version')),
                yeslabel="[B][COLOR springgreen]Install Theme[/COLOR][/B]",
                nolabel="[B][COLOR red]Cancel Themes[/COLOR][/B]")

        if installtheme:
            themezip = check.check_theme(name, theme, 'url')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            response = tools.open_url(themezip, check=True)
            if not response:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Theme Install: Invalid Zip Url![/COLOR]'.
                    format(CONFIG.COLOR2))
                return False

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Downloading:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1, zipname) + ' \n' +
                'Please Wait')

            lib = os.path.join(CONFIG.PACKAGES, '{0}.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(themezip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass

                return

            self.dialogProgress.update(0, '\n' + "Installing {0}".format(name))

            title = '[COLOR {0}][B]Installing Theme:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, theme)
            self.dialogProgress.update(0, title + '\n' + 'Please Wait')
            percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)
            CONFIG.set_setting('buildtheme', theme)
            logging.log('INSTALLED {0}: [ERRORS:{1}]'.format(percent, errors))
            self.dialogProgress.close()

            #db.force_check_updates(over=True)
            installed = db.grab_addons(lib)
            db.addon_database(installed, 1, True)
            xbmc.executebuiltin("ReloadSkin()")
            xbmc.sleep(1000)
            xbmc.executebuiltin("Container.Refresh()")
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Theme Install: Cancelled![/COLOR]'.format(
                    CONFIG.COLOR2))
Example #29
0
    def build(self, name, over=False):
        # if action == 'normal':
        # if CONFIG.KEEPTRAKT == 'true':
        # from resources.libs import traktit
        # traktit.auto_update('all')
        # CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPDEBRID == 'true':
        # from resources.libs import debridit
        # debridit.auto_update('all')
        # CONFIG.set_setting('debridnextsave', tools.get_date(days=3, formatted=True))
        # if CONFIG.KEEPLOGIN == 'true':
        # from resources.libs import loginit
        # loginit.auto_update('all')
        # CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))

        temp_kodiv = int(CONFIG.KODIV)
        buildv = int(float(check.check_build(name, 'kodi')))

        if not temp_kodiv == buildv:
            warning = True
        else:
            warning = False

        if warning:
            yes_pressed = self.dialog.yesno(
                "{0} - [COLOR red]WARNING!![/COLOR]".format(CONFIG.ADDONTITLE),
                '[COLOR {0}]Existe la posibilidad de que la piel no se vea correctamente'
                .format(CONFIG.COLOR2) + '\n' +
                'Al instalar un {0} build sobre un Kodi {1} Instalar'.format(
                    check.check_build(name, 'kodi'), CONFIG.KODIV) + '\n' +
                '¿Todavía te gustaría instalar: [COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'
                .format(CONFIG.COLOR1, name, check.check_build(
                    name, 'version')),
                nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]SI, INSTALAR[/COLOR][/B]')
        else:
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]¿Le gustaría descargar e instalar: '.format(
                        CONFIG.COLOR2) +
                    '[COLOR {0}]{1} v{2}[/COLOR]?[/COLOR]'.format(
                        CONFIG.COLOR1, name, check.check_build(
                            name, 'version')),
                    nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]',
                    yeslabel='[B][COLOR springgreen]si, instalar[/COLOR][/B]')
        if yes_pressed:
            CONFIG.clear_setting('build')
            buildzip = check.check_build(name, 'url')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]descargando:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1, name,
                        check.check_build(name, 'version')) + '\n' +
                'espere por favor')

            lib = os.path.join(CONFIG.MYBUILDS, '{0}.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(buildzip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass

                return

            yes_fresh = self.dialog.yesno(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][COLOR {1}]¿Desea borrar todos los datos antes de instalar?[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1),
                nolabel='[B][COLOR red]No gracias[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]si[/COLOR][/B]')
            if yes_fresh:
                install.wipe()

            skin.look_and_feel_data('save')

            title = '[COLOR {0}][B]instalando:[/B][/COLOR] [COLOR {1}]{2} v{3}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, name,
                check.check_build(name, 'version'))
            self.dialogProgress.update(0, title + '\n' + 'espere por favor')
            percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)

            skin.skin_to_default('Build Install')

            if int(float(percent)) > 0:
                db.fix_metas()
                CONFIG.set_setting('buildname', name)
                CONFIG.set_setting('buildversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting('buildtheme', '')
                CONFIG.set_setting('latestversion',
                                   check.check_build(name, 'version'))
                CONFIG.set_setting(
                    'nextbuildcheck',
                    tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
                CONFIG.set_setting('installed', 'true')
                CONFIG.set_setting('extract', percent)
                CONFIG.set_setting('errors', errors)
                logging.log('INSTALLED {0}: [ERRORS:{1}]'.format(
                    percent, errors))

                try:
                    os.remove(lib)
                except:
                    pass

                if int(float(errors)) > 0:
                    yes_pressed = self.dialog.yesno(
                        CONFIG.ADDONTITLE,
                        '[COLOR {0}][COLOR {1}]{2} v{3}[/COLOR]'.format(
                            CONFIG.COLOR2, CONFIG.COLOR1, name,
                            check.check_build(name, 'version')) + '\n' +
                        'Completado: [COLOR {0}]{1}{2}[/COLOR] [Errors:[COLOR {3}]{4}[/COLOR]]'
                        .format(CONFIG.COLOR1, percent, '%', CONFIG.COLOR1,
                                errors) + '\n' +
                        '¿Le gustaría ver los errores?[/COLOR]',
                        nolabel='[B][COLOR red]No [/COLOR][/B]',
                        yeslabel='[B][COLOR springgreen]si[/COLOR][/B]')
                    if yes_pressed:
                        from resources.libs.gui import window
                        window.show_text_box("Viewing Build Install Errors",
                                             error)
                self.dialogProgress.close()

                from resources.libs.gui.build_menu import BuildMenu
                #themecount = BuildMenu().theme_count(name)

                #if themecount > 0:
                #self.theme(name, 'theme')

                db.addon_database(CONFIG.ADDON_ID, 1)
                #db.force_check_updates(over=True)

                self.dialog.ok(
                    CONFIG.ADDONTITLE,
                    "[COLOR {0}]Para guardar los cambios, ahora necesita forzar el cierre de Kodi, presione OK para forzar el cierre de Kodi[/COLOR]"
                    .format(CONFIG.COLOR2))
                tools.kill_kodi(over=True)
            else:
                from resources.libs.gui import window
                window.show_text_box("Viewing Build Install Errors", error)
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Instalación de compilación: cancelada.[/COLOR]'.
                format(CONFIG.COLOR2))
Example #30
0
                    REPOID).findall(link)
 if len(match) == 0:
     wiz.log("Invalid URL for Repo Zip", xbmc.LOGERROR)
 else:
     installzip = '%s-%s.zip' % (REPOID, match[0])
     workingrepo = wiz.workingURL(REPOZIPURL + installzip)
     if workingrepo == True:
         DP.create(ADDONTITLE, 'Downloading Repo...', '', 'Please Wait')
         if not os.path.exists(PACKAGES): os.makedirs(PACKAGES)
         lib = os.path.join(PACKAGES, installzip)
         try:
             os.remove(lib)
         except:
             pass
         downloader.download(REPOZIPURL + installzip, lib, DP)
         extract.all(lib, ADDONS, DP)
         f = open(os.path.join(ADDONS, REPOID, 'addon.xml'),
                  mode='r').read()
         match = re.compile('<addon.+?id="%s".+?ame="(.+?)".+?>' %
                            REPOID).findall(f)
         wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, match[0]),
                       "[COLOR %s]Add-on updated[/COLOR]" % COLOR2,
                       icon=os.path.join(ADDONS, REPOID, 'icon.png'))
         DP.close()
         xbmc.sleep(500)
         wiz.forceUpdate(True)
         wiz.log("[Auto Install Repo] Successfully Installed",
                 xbmc.LOGNOTICE)
     else:
         wiz.LogNotify(
             "[COLOR %s]Repo Install Error[/COLOR]" % COLOR1,
Example #31
0
    def gui(self, name, over=False):
        if name == CONFIG.get_setting('buildname'):
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Le gustaria aplicar la correccion de interfaz gráfica de usuario para:'
                    .format(CONFIG.COLOR2) + '\n' +
                    '[COLOR {0}]{1}[/COLOR]?[/COLOR]'.format(
                        CONFIG.COLOR1, name),
                    nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]',
                    yeslabel=
                    '[B][COLOR springgreen]Aplicar Correccion[/COLOR][/B]')
        else:
            yes_pressed = self.dialog.yesno(
                "[B]{0} - [COLOR red]ADVERTENCIA!![/COLOR][/B]".format(
                    CONFIG.ADDONTITLE),
                "[COLOR {0}][COLOR {1}]{2}[/COLOR] [B]La Build de la comunidad no está instalada actualmente."
                .format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' +
                "Le gustaría aplicar la Corrección Gui ([COLOR azure]de la interfaz gráfica de usuario[/COLOR]) de todos modos?[/B][/COLOR]",
                nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]',
                yeslabel='[B][COLOR springgreen]Aplicar Correccion[/COLOR][/B]'
            )
        if yes_pressed:
            guizip = check.check_build(name, 'gui')
            zipname = name.replace('\\', '').replace('/', '').replace(
                ':',
                '').replace('*', '').replace('?', '').replace('"', '').replace(
                    '<', '').replace('>', '').replace('|', '')

            response = tools.open_url(guizip, check=True)
            if not response:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Corrección Gui: Url Zip Inválido![/COLOR]'.
                    format(CONFIG.COLOR2))
                return

            self.dialogProgress.create(
                CONFIG.ADDONTITLE,
                '[COLOR {0}][B]Descargando Correccion Gui:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'
                .format(CONFIG.COLOR2, CONFIG.COLOR1,
                        name), '', 'Espere por Favor')

            lib = os.path.join(CONFIG.PACKAGES,
                               '{0}_guisettings.zip'.format(zipname))

            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(guizip, lib)
            xbmc.sleep(500)

            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass

                return

            title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
                CONFIG.COLOR2, CONFIG.COLOR1, name)
            self.dialogProgress.update(0, title + '\n' + 'Espere por Favor')
            extract.all(lib, CONFIG.USERDATA, title=title)
            self.dialogProgress.close()
            skin.skin_to_default('Build Install')
            skin.look_and_feel_data('save')
            installed = db.grab_addons(lib)
            db.addon_database(installed, 1, True)

            self.dialog.ok(
                CONFIG.ADDONTITLE,
                "[COLOR {0}][B]Para guardar los cambios, ahora necesita Forzar el Cierre de Kodi.[/B] \n\nPresione [B]OK[/B] para Forzar el Cierre de Kodi.[/COLOR]"
                .format(CONFIG.COLOR2))
            tools.kill_kodi(over=True)
        else:
            logging.log_notify(
                CONFIG.ADDONTITLE,
                '[COLOR {0}]Corrección Gui:[/COLOR] [COLOR gold]Cancelado![/COLOR]'
                .format(CONFIG.COLOR2))