def choose(self, location): from resources.libs import skin skin.look_and_feel_data('restore') external = 'External' if self.external else 'Local' file = self.dialog.browseSingle(1, '[COLOR {0}]Selecione o arquivo de backup que deseja restaurar[/COLOR]'.format( CONFIG.COLOR2), '' if self.external else 'files', mask='.zip', useThumbs=True, defaultt=None if self.external else CONFIG.MYBUILDS) if not file.endswith('.zip'): logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]{1} Restaurar: Cancelado[/COLOR]".format( CONFIG.COLOR2, external)) return if self.external: from resources.libs.common import tools response = tools.open_url(file, check=True) if not response: logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]Restauração externa: URL inválido[/COLOR]".format(CONFIG.COLOR2)) return skin.skin_to_default("Restore") self.progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Installing {1} Backup'.format(CONFIG.COLOR2, external) + '\n' + 'Por favor, aguarde...[/COLOR]') self._from_file(file, location)
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]WARNING: Sometimes Reloading the Profile causes Kodi to crash. While Kodi is Reloading the Profile Please Do Not Press Any Buttons![/COLOR]".format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format(CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok( CONFIG.ADDONTITLE, "[COLOR red]ADVERTENCIA:[/COLOR] [COLOR {0}] A veces, Recargando el Perfil hace que Kodi se bloquee. Mientras Kodi está Recargando el Perfil, Por Favor No Presione Ningún Botón![/COLOR]" .format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format( CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
def choose(self, location): from resources.libs import skin skin.look_and_feel_data() external = 'External' if self.external else 'Local' file = self.dialog.browseSingle(1, '[COLOR {0}]Select the backup file you want to restore[/COLOR]'.format( CONFIG.COLOR2), '' if self.external else 'files', mask='.zip', useThumbs=True, defaultt=None if self.external else CONFIG.MYBUILDS) if not file.endswith('.zip'): logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]{1} Restore: Cancelled[/COLOR]".format( CONFIG.COLOR2, external)) return if self.external: from resources.libs.common import tools response = tools.open_url(file, check=True) if not response: logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]External Restore: Invalid URL[/COLOR]".format(CONFIG.COLOR2)) return skin.skin_to_default("Restore") self.progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Installing {1} Backup'.format( CONFIG.COLOR2, external), '', 'Please Wait[/COLOR]') self._from_file(file, location)
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok( CONFIG.ADDONTITLE, "[COLOR {0}]AVISO: Às vezes, recarregar o perfil causa o travamento do Kodi. Enquanto Kodi estiver recarregando o perfil, não pressione nenhum botão![/COLOR]" .format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format( CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
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))
def _choose(self, loc): from resources.libs.common import logging from resources.libs import skin dialog = xbmcgui.Dialog() progress_dialog = xbmcgui.DialogProgress() skin.look_and_feel_data() if not self.external: file = dialog.browseSingle(1, '[COLOR {0}]Select the backup file you want to restore[/COLOR]'.format( CONFIG.COLOR2), 'files', mask='.zip', useThumbs=True, defaultt=CONFIG.MYBUILDS) if not file.endswith('.zip'): logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Local Restore: Cancelled[/COLOR]".format(CONFIG.COLOR2)) return skin.skin_to_default("Restore") progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Installing Local Backup'.format(CONFIG.COLOR2), '', 'Please Wait[/COLOR]') self._local(file, loc) elif self.external: from resources.libs.common import tools source = dialog.browseSingle(1, '[COLOR {0}]Select the backup file you want to restore[/COLOR]'.format( CONFIG.COLOR2), '', mask='.zip', useThumbs=True) if not source.endswith('.zip'): logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]External Restore: Cancelled[/COLOR]".format(CONFIG.COLOR2)) return response = tools.open_url(source, check=True) if not response: logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]External Restore: Invalid URL[/COLOR]".format(CONFIG.COLOR2)) return skin.skin_to_default("Restore") self._external(source, loc)
def choose(self, location): from resources.libs import skin skin.look_and_feel_data('restaurar') external = 'External' if self.external else 'Local' file = self.dialog.browseSingle( 1, '[COLOR {0}]Seleccione el archivo de la Copia de Seguridad que desea restaurar[/COLOR]' .format(CONFIG.COLOR2), '' if self.external else 'archivos', mask='.zip', useThumbs=True, defaultt=None if self.external else CONFIG.MYBUILDS) if not file.endswith('.zip'): logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]{1} Restaurar: [COLOR gold]Cancelado[/COLOR]". format(CONFIG.COLOR2, external)) return if self.external: from resources.libs.common import tools response = tools.open_url(file, check=True) if not response: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Restaurar Externa:[/COLOR] [COLOR gold]URL Inválida[/COLOR]" .format(CONFIG.COLOR2)) return skin.skin_to_default("Restore") self.progress_dialog.create( CONFIG.ADDONTITLE, '[COLOR {0}]Instalando {1} Backup'.format( CONFIG.COLOR2, external) + '\n' + 'Espere por Favor[/COLOR]') self._from_file(file, location)
def installed_build_check(): dialog = xbmcgui.Dialog() if not CONFIG.EXTRACT == '100' and CONFIG.EXTERROR > 0: logging.log( "[Build Installed Check] Build foi extraído {0}/100 with [ERROS: {1}]" .format(CONFIG.EXTRACT, CONFIG.EXTERROR), level=xbmc.LOGINFO) yes = dialog.yesno( CONFIG.ADDONTITLE, '[COLOR {0}]{2}[/COLOR] [COLOR {1}]não foi instalado corretamente![/COLOR]' .format(CONFIG.COLOR1, CONFIG.COLOR2, CONFIG.BUILDNAME) + '\n' + ('Instalado: [COLOR {0}]{1}[/COLOR] / ' 'Error Count: [COLOR {2}]{3}[/COLOR]').format( CONFIG.COLOR1, CONFIG.EXTRACT, CONFIG.COLOR1, CONFIG.EXTERROR) + '\n' + 'Você gostaria de tentar de novo?[/COLOR]', nolabel='[B]Não, obrigado![/B]', yeslabel='[B]Tentar novamente[/B]') CONFIG.clear_setting('build') if yes: xbmc.executebuiltin( "PlayMedia(plugin://{0}/?mode=install&name={1}&url=fresh)". format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log("[Build Installed Check] Nova instalação reset", level=xbmc.LOGINFO) else: logging.log("[Build Installed Check] Reinstall Ignored") elif CONFIG.SKIN in ['skin.confluence', 'skin.estuary', 'skin.estouchy']: logging.log("[Build Installed Check] Incorrect skin: {0}".format( CONFIG.SKIN), level=xbmc.LOGINFO) defaults = CONFIG.get_setting('defaultskin') if not defaults == '': if os.path.exists(os.path.join(CONFIG.ADDONS, defaults)): if skin.skin_to_default(defaults): skin.look_and_feel_data('restore') if not CONFIG.SKIN == defaults and not CONFIG.BUILDNAME == "": gui_xml = check.check_build(CONFIG.BUILDNAME, 'gui') response = tools.open_url(gui_xml, check=True) if not response: logging.log( "[Build Installed Check] Guifix was set to http://", level=xbmc.LOGINFO) dialog.ok( CONFIG.ADDONTITLE, "[COLOR {0}]Parece que as configurações de skin não foram aplicadas à build." .format(CONFIG.COLOR2) + '\n' + "Infelizmente, nenhuma correção de interface foi anexada a build" + '\n' + "Você precisará reinstalar a compilação e certificar-se de fazer um fechamento forçado[/COLOR]" ) else: yes = dialog.yesno( CONFIG.ADDONTITLE, '{0} não foi instalado corretamente!'.format( CONFIG.BUILDNAME) + '\n' + 'Parece que as configurações de skin não foram aplicadas à build.' + '\n' + 'Você gostaria de aplicar o GuiFix?', nolabel='[B]Não, Cancelar[/B]', yeslabel='[B]Aplicar Fix[/B]') if yes: xbmc.executebuiltin( "PlayMedia(plugin://{0}/?mode=install&name={1}&url=gui)" .format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log( "[Build Installed Check] Guifix tentando instalar") else: logging.log( '[Build Installed Check] Guifix url funcionando, mas cancelado: {0}' .format(gui_xml), level=xbmc.LOGINFO) else: logging.log( '[Build Installed Check] A instalação parece ter sido concluída corretamente', level=xbmc.LOGINFO) if CONFIG.get_setting('installed') == 'true': if CONFIG.get_setting('keeptrakt') == 'true': from resources.libs import traktit logging.log('[Build Installed Check] Restoring Trakt Data', level=xbmc.LOGINFO) traktit.trakt_it('restore', 'all') if CONFIG.get_setting('keepdebrid') == 'true': from resources.libs import debridit logging.log('[Build Installed Check] Restoring Real Debrid Data', level=xbmc.LOGINFO) debridit.debrid_it('restore', 'all') if CONFIG.get_setting('keeplogin') == 'true': from resources.libs import loginit logging.log('[Build Installed Check] Restoring Login Data', level=xbmc.LOGINFO) loginit.login_it('restore', 'all') CONFIG.clear_setting('install')
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))
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)), "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), '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, theme), '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, theme), '', '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, "", "Installing {0}".format(name)) test1 = False test2 = False from resources.libs import skin from resources.libs import test test1 = test.test_theme( lib) if CONFIG.SKIN not in skin.DEFAULT_SKINS else False test2 = test.test_gui( lib) if CONFIG.SKIN not in skin.DEFAULT_SKINS else False if test1: skin.look_and_feel_data('save') swap = skin.skin_to_default('Theme Install') if not swap: return False xbmc.sleep(500) title = '[COLOR {0}][B]Installing Theme:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format( CONFIG.COLOR2, CONFIG.COLOR1, theme) self.dialogProgress.update(0, title, '', '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) if test2: skin.look_and_feel_data('save') skin.skin_to_default("Theme Install") gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin, "Theme Installer") skin.look_and_feel_data('restore') elif test1: skin.look_and_feel_data('save') skin.skin_to_default("Theme Install") gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin, "Theme Installer") skin.look_and_feel_data('restore') else: 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))
def check_skin(): from resources.libs.common import logging from resources.libs.common import tools dialog = xbmcgui.Dialog() logging.log("[Build Check] Invalid Skin Check Start") gotoskin = False if not CONFIG.DEFAULTSKIN == '': if os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.DEFAULTSKIN)): if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]It seems that the skin has been set back to [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()), "Would you like to set the skin back to:[/COLOR]", '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.DEFAULTNAME)): gotoskin = CONFIG.DEFAULTSKIN gotoname = CONFIG.DEFAULTNAME else: logging.log("Skin was not reset") CONFIG.set_setting('defaultskinignore', 'true') gotoskin = False else: CONFIG.set_setting('defaultskin', '') CONFIG.set_setting('defaultskinname', '') CONFIG.DEFAULTSKIN = '' CONFIG.DEFAULTNAME = '' if CONFIG.DEFAULTSKIN == '': skinname = [] skinlist = [] for folder in glob.glob(os.path.join(CONFIG.ADDONS, 'skin.*/')): xml = "{0}/addon.xml".format(folder) if os.path.exists(xml): g = tools.read_from_file(xml).replace('\n', '').replace( '\r', '').replace('\t', '') match = tools.parse_dom(g, 'addon', ret='id') match2 = tools.parse_dom(g, 'addon', ret='name') logging.log("{0}: {1}".format(folder, str(match[0]))) if len(match) > 0: skinlist.append(str(match[0])) skinname.append(str(match2[0])) else: logging.log("ID not found for {0}".format(folder)) else: logging.log("ID not found for {0}".format(folder)) if len(skinlist) > 0: if len(skinlist) > 1: if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]It seems that the skin has been set back to [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()), "Would you like to view a list of avaliable skins?[/COLOR]" ): choice = dialog.select("Select skin to switch to!", skinname) if choice == -1: logging.log("Skin was not reset") CONFIG.set_setting('defaultskinignore', 'true') else: gotoskin = skinlist[choice] gotoname = skinname[choice] else: logging.log("Skin was not reset") CONFIG.set_setting('defaultskinignore', 'true') else: if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]It seems that the skin has been set back to [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()), "Would you like to set the skin back to:[/COLOR]", '[COLOR {0}]{1}[/COLOR]'.format( CONFIG.COLOR1, skinname[0])): gotoskin = skinlist[0] gotoname = skinname[0] else: logging.log("Skin was not reset") CONFIG.set_setting('defaultskinignore', 'true') else: logging.log("No skins found in addons folder.") CONFIG.set_setting('defaultskinignore', 'true') gotoskin = False if gotoskin: from resources.libs import skin if skin.switch_to_skin(gotoskin): skin.look_and_feel_data('restore') logging.log("[Build Check] Invalid Skin Check End")
def installed_build_check(): dialog = xbmcgui.Dialog() if not CONFIG.EXTRACT == '100' and CONFIG.EXTERROR > 0: logging.log("[Build Installed Check] Build was extracted {0}/100 with [ERRORS: {1}]".format(CONFIG.EXTRACT, CONFIG.EXTERROR), level=xbmc.LOGINFO) yes = dialog.yesno(CONFIG.ADDONTITLE, '[COLOR {0}]{2}[/COLOR] [COLOR {1}]was not installed correctly![/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, CONFIG.BUILDNAME) +'\n'+('Installed: [COLOR {0}]{1}[/COLOR] / ' 'Error Count: [COLOR {2}]{3}[/COLOR]').format(CONFIG.COLOR1, CONFIG.EXTRACT, CONFIG.COLOR1, CONFIG.EXTERROR) +'\n'+'Would you like to try again?[/COLOR]', nolabel='[B]No Thanks![/B]', yeslabel='[B]Retry Install[/B]') CONFIG.clear_setting('build') if yes: xbmc.executebuiltin("PlayMedia(plugin://{0}/?mode=install&name={1}&url=fresh)".format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log("[Build Installed Check] Fresh Install Re-activated", level=xbmc.LOGINFO) else: logging.log("[Build Installed Check] Reinstall Ignored") elif CONFIG.SKIN in ['skin.confluence', 'skin.estuary', 'skin.estouchy']: logging.log("[Build Installed Check] Incorrect skin: {0}".format(CONFIG.SKIN), level=xbmc.LOGINFO) defaults = CONFIG.get_setting('defaultskin') if not defaults == '': if os.path.exists(os.path.join(CONFIG.ADDONS, defaults)): if skin.skin_to_default(defaults): skin.look_and_feel_data('restore') if not CONFIG.SKIN == defaults and not CONFIG.BUILDNAME == "": gui_xml = check.check_build(CONFIG.BUILDNAME, 'gui') response = tools.open_url(gui_xml, check=True) if not response: logging.log("[Build Installed Check] Guifix was set to http://", level=xbmc.LOGINFO) dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]It looks like the skin settings was not applied to the build.".format(CONFIG.COLOR2) +'\n'+"Sadly no gui fix was attached to the build" +'\n'+"You will need to reinstall the build and make sure to do a force close[/COLOR]") else: yes = dialog.yesno(CONFIG.ADDONTITLE, '{0} was not installed correctly!'.format(CONFIG.BUILDNAME) +'\n'+'It looks like the skin settings was not applied to the build.' +'\n'+'Would you like to apply the GuiFix?', nolabel='[B]No, Cancel[/B]', yeslabel='[B]Apply Fix[/B]') if yes: xbmc.executebuiltin("PlayMedia(plugin://{0}/?mode=install&name={1}&url=gui)".format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log("[Build Installed Check] Guifix attempting to install") else: logging.log('[Build Installed Check] Guifix url working but cancelled: {0}'.format(gui_xml), level=xbmc.LOGINFO) else: logging.log('[Build Installed Check] Install seems to be completed correctly', level=xbmc.LOGINFO) if CONFIG.get_setting('installed') == 'true': if CONFIG.get_setting('keeptrakt') == 'true': from resources.libs import traktit logging.log('[Build Installed Check] Restoring Trakt Data', level=xbmc.LOGINFO) traktit.trakt_it('restore', 'all') if CONFIG.get_setting('keepdebrid') == 'true': from resources.libs import debridit logging.log('[Build Installed Check] Restoring Real Debrid Data', level=xbmc.LOGINFO) debridit.debrid_it('restore', 'all') if CONFIG.get_setting('keeplogin') == 'true': from resources.libs import loginit logging.log('[Build Installed Check] Restoring Login Data', level=xbmc.LOGINFO) loginit.login_it('restore', 'all') CONFIG.clear_setting('install')
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))
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))
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))
def check_skin(): from resources.libs.common import logging from resources.libs.common import tools dialog = xbmcgui.Dialog() logging.log( "[Verificación Build] Inicio de Comprobación del Skin Inválido") gotoskin = False if not CONFIG.DEFAULTSKIN == '': if os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.DEFAULTSKIN)): if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Parece que el skin se ha vuelto a poner [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()) + '\n' + "Le gustaría volver a poner el skin en:[/COLOR]" + '\n' + '[COLOR {0}]{1}[/COLOR]'.format( CONFIG.COLOR1, CONFIG.DEFAULTNAME)): gotoskin = CONFIG.DEFAULTSKIN gotoname = CONFIG.DEFAULTNAME else: logging.log("El Skin no se reseteó") CONFIG.set_setting('defaultskinignore', 'true') gotoskin = False else: CONFIG.set_setting('defaultskin', '') CONFIG.set_setting('defaultskinname', '') CONFIG.DEFAULTSKIN = '' CONFIG.DEFAULTNAME = '' if CONFIG.DEFAULTSKIN == '': skinname = [] skinlist = [] for folder in glob.glob(os.path.join(CONFIG.ADDONS, 'skin.*/')): xml = "{0}/addon.xml".format(folder) if os.path.exists(xml): g = tools.read_from_file(xml).replace('\n', '').replace( '\r', '').replace('\t', '') match = tools.parse_dom(g, 'addon', ret='id') match2 = tools.parse_dom(g, 'addon', ret='name') logging.log("{0}: {1}".format(folder, str(match[0]))) if len(match) > 0: skinlist.append(str(match[0])) skinname.append(str(match2[0])) else: logging.log("ID no encontrado para {0}".format(folder)) else: logging.log("ID no encontrado para {0}".format(folder)) if len(skinlist) > 0: if len(skinlist) > 1: if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Parece que el skin se ha vuelto a poner [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()) + '\n' + "Le gustaría ver una lista de skins disponibles?[/COLOR]" ): choice = dialog.select( "Seleccione el skin para cambiarlo!", skinname) if choice == -1: logging.log("El Skin no se reseteó") CONFIG.set_setting('defaultskinignore', 'true') else: gotoskin = skinlist[choice] gotoname = skinname[choice] else: logging.log("El Skin no se reseteó") CONFIG.set_setting('defaultskinignore', 'true') else: if dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Parece que el skin se ha vuelto a poner [COLOR {1}]{2}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.SKIN[5:].title()) + '\n' + "Le gustaría volver a poner el skin en:[/COLOR]" + '\n' + '[COLOR {0}]{1}[/COLOR]'.format( CONFIG.COLOR1, skinname[0])): gotoskin = skinlist[0] gotoname = skinname[0] else: logging.log("El Skin no se reseteó") CONFIG.set_setting('defaultskinignore', 'true') else: logging.log("No se encontraron skins en la carpeta de addons.") CONFIG.set_setting('defaultskinignore', 'true') gotoskin = False if gotoskin: from resources.libs import skin if skin.switch_to_skin(gotoskin): skin.look_and_feel_data('restore') logging.log("[Verificación Build] Fin de Comprobación del Skin Invalido")
def installed_build_check(): dialog = xbmcgui.Dialog() if not CONFIG.EXTRACT == '100' and CONFIG.EXTERROR > 0: logging.log("[Build Installed Check] Build fue extraído {0}/100 con [ERRORS: {1}]".format(CONFIG.EXTRACT, CONFIG.EXTERROR), level=xbmc.LOGINFO) yes = dialog.yesno(CONFIG.ADDONTITLE, '[COLOR {0}]{2}[/COLOR] [COLOR {1}]no se instaló correctamente![/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, CONFIG.BUILDNAME) +'\n'+('Instalado: [COLOR {0}]{1}[/COLOR] / ' 'Errores Encontrados: [COLOR {2}]{3}[/COLOR]').format(CONFIG.COLOR1, CONFIG.EXTRACT, CONFIG.COLOR1, CONFIG.EXTERROR) +'\n'+'¿Le gustaría volver a intentarlo?[/COLOR]', nolabel='[B]No, ¡Gracias![/B]', yeslabel='[B]Reintentar la Instalación[/B]') CONFIG.clear_setting('build') if yes: xbmc.executebuiltin("PlayMedia(plugin://{0}/?mode=install&name={1}&url=fresh)".format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log("[Build Installed Check] Instalación Nueva Re-activada", level=xbmc.LOGINFO) else: logging.log("[Build Installed Check] Reinstalar Ignorado") elif CONFIG.SKIN in ['skin.confluence', 'skin.estuary', 'skin.estouchy']: logging.log("[Build Installed Check] Skin Incorrecto: {0}".format(CONFIG.SKIN), level=xbmc.LOGINFO) defaults = CONFIG.get_setting('defaultskin') if not defaults == '': if os.path.exists(os.path.join(CONFIG.ADDONS, defaults)): if skin.skin_to_default(defaults): skin.look_and_feel_data('restore') if not CONFIG.SKIN == defaults and not CONFIG.BUILDNAME == "": gui_xml = check.check_build(CONFIG.BUILDNAME, 'gui') response = tools.open_url(gui_xml, check=True) if not response: logging.log("[Build Installed Check] Guifix estaba configurado para http://", level=xbmc.LOGINFO) dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]Parece que la configuración de la máscara no se aplicó a la build.".format(CONFIG.COLOR2) +'\n'+"Lamentablemente, no se adjuntó ninguna corrección de interfaz gráfica de usuario a la build" +'\n'+"Deberá reinstalar la build y asegurarse de hacer un cierre forzado[/COLOR]") else: yes = dialog.yesno(CONFIG.ADDONTITLE, '{0} No se instaló correctamente!'.format(CONFIG.BUILDNAME) +'\n'+'Parece que la configuración de la máscara no se aplicó a la build.' +'\n'+'Le gustaría aplicar el GuiFix?', nolabel='[B]No, Cancelar[/B]', yeslabel='[B]Aplicar Fix[/B]') if yes: xbmc.executebuiltin("PlayMedia(plugin://{0}/?mode=install&name={1}&url=gui)".format(CONFIG.ADDON_ID, quote_plus(CONFIG.BUILDNAME))) logging.log("[Build Installed Check] Intentando instalar Guifix") else: logging.log('[Build Installed Check] URL de Guifix funcionando, pero cancelada: {0}'.format(gui_xml), level=xbmc.LOGINFO) else: logging.log('[Build Installed Check] La instalación parece haberse completado correctamente', level=xbmc.LOGINFO) if CONFIG.get_setting('installed') == 'true': if CONFIG.get_setting('keeptrakt') == 'true': from resources.libs import traktit logging.log('[Build Installed Check] Restaurando Trakt Data', level=xbmc.LOGINFO) traktit.trakt_it('restore', 'all') if CONFIG.get_setting('keepdebrid') == 'true': from resources.libs import debridit logging.log('[Build Installed Check] Restaurando Real Debrid Data', level=xbmc.LOGINFO) debridit.debrid_it('restore', 'all') if CONFIG.get_setting('keeplogin') == 'true': from resources.libs import loginit logging.log('[Build Installed Check] Restaurando Login Data', level=xbmc.LOGINFO) loginit.login_it('restore', 'all') CONFIG.clear_setting('install')