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 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 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 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 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 wipe(): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs.common import tools from resources.libs import update if CONFIG.KEEPTRAKT == 'true': from resources.libs import traktit traktit.auto_update('all') CONFIG.set_setting('traktnextsave', str(tools.get_date(days=3, formatted=True))) if CONFIG.KEEPDEBRID == 'true': from resources.libs import debridit debridit.auto_update('all') CONFIG.set_setting('debridnextsave', str(tools.get_date(days=3, formatted=True))) if CONFIG.KEEPLOGIN == 'true': from resources.libs import loginit loginit.auto_update('all') CONFIG.set_setting('loginnextsave', str(tools.get_date(days=3, formatted=True))) exclude_dirs = CONFIG.EXCLUDES exclude_dirs.append('My_Builds') progress_dialog = xbmcgui.DialogProgress() skin.skin_to_default('Fresh Install') update.addon_updates('set') xbmcPath = os.path.abspath(CONFIG.HOME) progress_dialog.create(CONFIG.ADDONTITLE, "[COLOR {0}]Calculating files and folders".format(CONFIG.COLOR2) + '\n' + '\n' + 'Please Wait![/COLOR]') total_files = sum([len(files) for r, d, files in os.walk(xbmcPath)]) del_file = 0 progress_dialog.update(0, "[COLOR {0}]Gathering Excludes list.[/COLOR]".format(CONFIG.COLOR2)) if CONFIG.KEEPREPOS == 'true': repos = glob.glob(os.path.join(CONFIG.ADDONS, 'repo*/')) for item in repos: repofolder = os.path.split(item[:-1])[1] if not repofolder == exclude_dirs: exclude_dirs.append(repofolder) if CONFIG.KEEPSUPER == 'true': exclude_dirs.append('plugin.program.super.favourites') if CONFIG.KEEPWHITELIST == 'true': from resources.libs import whitelist whitelist = whitelist.whitelist('read') if len(whitelist) > 0: for item in whitelist: try: name, id, fold = item except: pass depends = db.depends_list(fold) for plug in depends: if plug not in exclude_dirs: exclude_dirs.append(plug) depends2 = db.depends_list(plug) for plug2 in depends2: if plug2 not in exclude_dirs: exclude_dirs.append(plug2) if fold not in exclude_dirs: exclude_dirs.append(fold) for item in CONFIG.DEPENDENCIES: exclude_dirs.append(item) progress_dialog.update(0, "[COLOR {0}]Clearing out files and folders:".format(CONFIG.COLOR2)) latestAddonDB = db.latest_db('Addons') for root, dirs, files in os.walk(xbmcPath, topdown=True): dirs[:] = [d for d in dirs if d not in exclude_dirs] for name in files: del_file += 1 fold = root.replace('/', '\\').split('\\') x = len(fold)-1 if name == 'sources.xml' and fold[-1] == 'userdata' and CONFIG.KEEPSOURCES == 'true': logging.log("Keep sources.xml: {0}".format(os.path.join(root, name))) elif name == 'favourites.xml' and fold[-1] == 'userdata' and CONFIG.KEEPFAVS == 'true': logging.log("Keep favourites.xml: {0}".format(os.path.join(root, name))) elif name == 'profiles.xml' and fold[-1] == 'userdata' and CONFIG.KEEPPROFILES == 'true': logging.log("Keep profiles.xml: {0}".format(os.path.join(root, name))) elif name == 'playercorefactory.xml' and fold[-1] == 'userdata' and CONFIG.KEEPPLAYERCORE == 'true': logging.log("Keep playercorefactory.xml: {0}".format(os.path.join(root, name))) elif name == 'guisettings.xml' and fold[-1] == 'userdata' and CONFIG.KEEPGUISETTINGS == 'true': logging.log("Keep guisettings.xml: {0}".format(os.path.join(root, name))) elif name == 'advancedsettings.xml' and fold[-1] == 'userdata' and CONFIG.KEEPADVANCED == 'true': logging.log("Keep advancedsettings.xml: {0}".format(os.path.join(root, name))) elif name in CONFIG.LOGFILES: logging.log("Keep Log File: {0}".format(name)) elif name.endswith('.db'): try: if name == latestAddonDB: logging.log("Ignoring {0} on Kodi {1}".format(name, tools.kodi_version())) else: os.remove(os.path.join(root, name)) except Exception as e: if not name.startswith('Textures13'): logging.log('Failed to delete, Purging DB') logging.log("-> {0}".format(str(e))) db.purge_db_file(os.path.join(root, name)) else: progress_dialog.update(int(tools.percentage(del_file, total_files)), '\n' + '[COLOR {0}]File: [/COLOR][COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name)) try: os.remove(os.path.join(root, name)) except Exception as e: logging.log("Error removing {0}".format(os.path.join(root, name))) logging.log("-> / {0}".format(str(e))) if progress_dialog.iscanceled(): progress_dialog.close() logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]Fresh Start Cancelled[/COLOR]".format(CONFIG.COLOR2)) return False for root, dirs, files in os.walk(xbmcPath, topdown=True): dirs[:] = [d for d in dirs if d not in exclude_dirs] for name in dirs: progress_dialog.update(100, '\n' + 'Cleaning Up Empty Folder: [COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, name)) if name not in ["Database", "userdata", "temp", "addons", "addon_data"]: shutil.rmtree(os.path.join(root, name), ignore_errors=True, onerror=None) if progress_dialog.iscanceled(): progress_dialog.close() logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]Fresh Start Cancelled[/COLOR]".format(CONFIG.COLOR2)) return False progress_dialog.close() CONFIG.clear_setting('build')
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 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')
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 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')