def write_advanced(self, name, url): response = tools.open_url(url) if response: if os.path.exists(CONFIG.ADVANCED): choice = self.dialog.yesno(CONFIG.ADDONTITLE, "[COLOR {0}]Você gostaria de substituir suas configurações avançadas atuais com [COLOR {1}]{2}[/COLOR]?[/COLOR]".format( CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Sobrescrever[/COLOR][/B]", nolabel="[B][COLOR red]Cancelar[/COLOR][/B]") else: choice = self.dialog.yesno(CONFIG.ADDONTITLE, "[COLOR {0}]Você gostaria de baixar e instalar[COLOR {1}]{2}[/COLOR]?[/COLOR]".format( CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Instalar[/COLOR][/B]", nolabel="[B][COLOR red]Cancelar[/COLOR][/B]") if choice == 1: tools.write_to_file(CONFIG.ADVANCED, response.text) tools.kill_kodi(msg='[COLOR {0}]Instalar A nova predefinição advancedsettings.xml foi escrita com sucesso, mas as alterações não terão efeito até que você feche o Kodi.[/COLOR]'.format( CONFIG.COLOR2)) else: logging.log("[Configurações avançadas] instalação cancelada") logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Escrita cancelada![/COLOR]".format(CONFIG.COLOR2)) return else: logging.log("[Configurações avançadas] URL não funciona: {0}".format(url)) logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]URL não funcionaF[/COLOR]".format(CONFIG.COLOR2))
def fresh_start(install=None, over=False): from resources.libs.common import logging from resources.libs.common import tools dialog = xbmcgui.Dialog() # 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))) if over: yes_pressed = 1 elif install == 'restore': yes_pressed = dialog.yesno(CONFIG.ADDONTITLE, "Bạn có muốn khôi phục Kodi về mặc định.", "Trước khi cài đặt bản Build cá nhân?[/COLOR]", nolabel='[B][COLOR red]Không![/COLOR][/B]', yeslabel='[B][COLOR springgreen]Tiếp Tục![/COLOR][/B]') elif install: yes_pressed = dialog.yesno(CONFIG.ADDONTITLE, "Bạn có muốn khôi phục Kodi về mặc định.", "Trước khi cài đặt [COLOR {0}]{1}[/COLOR]?".format(CONFIG.COLOR1, install), nolabel='[B][COLOR red]Không![/COLOR][/B]', yeslabel='[B][COLOR springgreen]Tiếp Tục[/COLOR][/B]') else: yes_pressed = dialog.yesno(CONFIG.ADDONTITLE, "Bạn có muốn khôi phục Kodi về mặc định.", nolabel='[B][COLOR red]Không![/COLOR][/B]', yeslabel='[B][COLOR springgreen]Tiếp Tục![/COLOR][/B]') if yes_pressed: wipe() if over: return True elif install == 'restore': return True elif install: from resources.libs.wizard import Wizard Wizard().build('normal', install, over=True) else: dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]Để thay đổi có hiệu lực cần thoát hẳn KODI.\nNhấn OK để thoát Kodi[/COLOR]".format(CONFIG.COLOR2)) from resources.libs import update update.addon_updates('reset') tools.kill_kodi(over=True) else: if not install == 'restore': logging.log_notify(CONFIG.ADDONTITLE, '[COLOR {0}]Fresh Install: Cancelled![/COLOR]'.format(CONFIG.COLOR2)) xbmc.executebuiltin('Container.Refresh()')
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 remove_addon_menu(): from resources.libs.common import logging from resources.libs.common import tools from resources.libs import update from xml.etree import ElementTree dialog = xbmcgui.Dialog() addonfolders = glob.iglob(os.path.join(CONFIG.ADDONS, '*/')) addonnames = [] addonids = [] for folder in addonfolders: foldername = os.path.split(folder[:-1])[1] if foldername in CONFIG.EXCLUDES: continue elif foldername in CONFIG.DEFAULTPLUGINS: continue elif foldername == 'packages': continue xml = os.path.join(folder, 'addon.xml') if os.path.exists(xml): root = ElementTree.parse(xml).getroot() addonid = root.get('id') addonname = root.get('name') try: addonnames.append(addonname) addonids.append(addonid) except: pass if len(addonnames) == 0: logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]No hay complementos para eliminar[/COLOR]".format(CONFIG.COLOR2)) return selected = dialog.multiselect("{0}: Seleccione los complementos que desea eliminar.".format(CONFIG.ADDONTITLE), addonnames) if not selected: return if len(selected) > 0: update.addon_updates('set') for addon in selected: remove_addon(addon=addonids[addon], name=addonnames[addon], over=True) xbmc.sleep(500) 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)) update.addon_updates('reset') tools.kill_kodi(over=True)
def remove_addon_menu(): from resources.libs.common import logging from resources.libs.common import tools from resources.libs import update from xml.etree import ElementTree dialog = xbmcgui.Dialog() addonfolders = glob.iglob(os.path.join(CONFIG.ADDONS, '*/')) addonnames = [] addonids = [] for folder in addonfolders: foldername = os.path.split(folder[:-1])[1] if foldername in CONFIG.EXCLUDES: continue elif foldername in CONFIG.DEFAULTPLUGINS: continue elif foldername == 'packages': continue xml = os.path.join(folder, 'addon.xml') if os.path.exists(xml): root = ElementTree.parse(xml).getroot() addonid = root.get('id') addonname = root.get('name') try: addonnames.append(addonname) addonids.append(addonid) except: pass if len(addonnames) == 0: logging.log_notify(CONFIG.ADDONTITLE, "[COLOR {0}]No Addons To Remove[/COLOR]".format(CONFIG.COLOR2)) return selected = dialog.multiselect("{0}: Select the addons you wish to remove.".format(CONFIG.ADDONTITLE), addonnames) if not selected: return if len(selected) > 0: update.addon_updates('set') for addon in selected: remove_addon(addon=addonids[addon], name=addonnames[addon], over=True) xbmc.sleep(500) 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)) update.addon_updates('reset') tools.kill_kodi(over=True)
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))
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))
def write_advanced(self, name, url): response = tools.open_url(url) if response: if os.path.exists(CONFIG.ADVANCED): choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Bạn có muốn ghi đè file [COLOR {1}]AdvancedSettings.xml[/COLOR] hiện có?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1), yeslabel="[B][COLOR springgreen]Overwrite[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") else: choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Bạn đã đồng ý ghi đè file [COLOR {1}]AdvancedSettings.xml[/COLOR] \nNhấn [COLOR springgreen]Install[/COLOR] để xác nhận." .format(CONFIG.COLOR2, CONFIG.COLOR1), yeslabel="[B][COLOR springgreen]Install[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") if choice == 1: tools.write_to_file(CONFIG.ADVANCED, response.text) self.dialog.ok( CONFIG.ADDONTITLE, 'Memcache sẽ được lấy tự động dựa vào dung lượng ram trống hiện có.' ) category = 'cache' tag = 'memorysize' value = None self.set_setting(category, tag, value) tools.kill_kodi( msg= '[COLOR {0}]File AdvancedSettings.xml đã được thiết lập, bạn cần Restart Kodi để có hiệu lực.[/COLOR]' .format(CONFIG.COLOR2)) else: logging.log("[Advanced Settings] install canceled") logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Write Cancelled![/COLOR]".format( CONFIG.COLOR2)) return else: logging.log("[Advanced Settings] URL not working: {0}".format(url)) logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]URL Not Working[/COLOR]".format(CONFIG.COLOR2))
def fix_update(): if os.path.exists(os.path.join(CONFIG.USERDATA, 'autoexec.py')): temp = os.path.join(CONFIG.USERDATA, 'autoexec_temp.py') if os.path.exists(temp): xbmcvfs.delete(temp) xbmcvfs.rename(os.path.join(CONFIG.USERDATA, 'autoexec.py'), temp) xbmcvfs.copy(os.path.join(CONFIG.PLUGIN, 'resources', 'libs', 'autoexec.py'), os.path.join(CONFIG.USERDATA, 'autoexec.py')) dbfile = os.path.join(CONFIG.DATABASE, latest_db('Addons')) try: os.remove(dbfile) except: logging.log("Unable to remove {0}, Purging DB".format(dbfile)) purge_db_file(dbfile) from resources.libs.common import tools tools.kill_kodi(over=True)
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))
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))
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))
def write_advanced(name, url): from resources.libs.common import tools from resources.libs.common import logging dialog = xbmcgui.Dialog() response = tools.open_url(url) if response: if os.path.exists(CONFIG.ADVANCED): choice = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Would you like to overwrite your current Advanced Settings with [COLOR {1}]{}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Overwrite[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") else: choice = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Would you like to download and install [COLOR {1}]{2}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Install[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") if choice == 1: tools.write_to_file(CONFIG.ADVANCED, response.text) dialog.ok( CONFIG.ADDONTITLE, '[COLOR {0}]AdvancedSettings.xml file has been successfully written. Once you click okay it will force close kodi.[/COLOR]' .format(CONFIG.COLOR2)) tools.kill_kodi(over=True) else: logging.log("[Advanced Settings] install canceled") logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Write Cancelled![/COLOR]".format(CONFIG.COLOR2)) return else: logging.log("[Advanced Settings] URL not working: {0}".format(url)) logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]URL Not Working[/COLOR]".format(CONFIG.COLOR2))
def write_advanced(self, name, url): response = tools.open_url(url) if response: if os.path.exists(CONFIG.ADVANCED): choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Le gustaría sobrescribir su Advanced Settings actual [COLOR {1}]{2}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Sobrescribir[/COLOR][/B]", nolabel="[B][COLOR red]Cancelar[/COLOR][/B]") else: choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Le gustaría descargar e instalar [COLOR {1}]{2}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR springgreen]Instalar[/COLOR][/B]", nolabel="[B][COLOR red]Cancelar[/COLOR][/B]") if choice == 1: tools.write_to_file(CONFIG.ADVANCED, response.text) tools.kill_kodi( msg= '[COLOR {0}]El nuevo ajuste preestablecido advancedsettings.xml se ha escrito correctamente, pero los cambios no surtirán efecto hasta que cierre Kodi.[/COLOR]' .format(CONFIG.COLOR2)) else: logging.log("[Advanced Settings] instalación canceleda") logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Escritura Canceleda![/COLOR]".format( CONFIG.COLOR2)) return else: logging.log("[Advanced Settings] URL no funciona: {0}".format(url)) logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]URL No Funciona[/COLOR]".format(CONFIG.COLOR2))
def write_advanced(self, name, url): response = tools.open_url(url) if response: if os.path.exists(CONFIG.ADVANCED): choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Would you like to overwrite your current Advanced Settings with [COLOR {1}]{2}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR deepskyblue]Overwrite[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") else: choice = self.dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Would you like to download and install [COLOR {1}]{2}[/COLOR]?[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, name), yeslabel="[B][COLOR deepskyblue]Install[/COLOR][/B]", nolabel="[B][COLOR red]Cancel[/COLOR][/B]") if choice == 1: tools.write_to_file(CONFIG.ADVANCED, response.text) tools.kill_kodi( msg= '[COLOR {0}]The new advancedsettings.xml preset has been successfully written, but changes won\'t take effect until you close Kodi.[/COLOR]' .format(CONFIG.COLOR2)) else: logging.log("[Advanced Settings] install canceled") logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Write Cancelled![/COLOR]".format( CONFIG.COLOR2)) return else: logging.log("[Advanced Settings] URL not working: {0}".format(url)) logging.log_notify( '[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]URL Not Working[/COLOR]".format(CONFIG.COLOR2))
def dispatch(self, handle, paramstring): self._log_params(paramstring) mode = self.params['mode'] if 'mode' in self.params else None url = self.params['url'] if 'url' in self.params else None name = self.params['name'] if 'name' in self.params else None action = self.params['action'] if 'action' in self.params else None # MAIN MENU if mode is None: from resources.libs.gui.main_menu import MainMenu MainMenu().get_listing() self._finish(handle) # SETTINGS elif mode == 'settings': # OpenWizard settings CONFIG.open_settings(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'opensettings': # Open other addons' settings settings_id = eval(url.upper() + 'ID')[name]['plugin'] CONFIG.open_settings(settings_id) xbmc.executebuiltin('Container.Refresh()') elif mode == 'togglesetting': # Toggle a setting CONFIG.set_setting(name, 'false' if CONFIG.get_setting(name) == 'true' else 'true') xbmc.executebuiltin('Container.Refresh()') # MENU SECTIONS elif mode == 'builds': # Builds from resources.libs.gui.build_menu import BuildMenu BuildMenu().get_listing() self._finish(handle) elif mode == 'viewbuild': # Builds -> "Your Build" from resources.libs.gui.build_menu import BuildMenu BuildMenu().view_build(name) self._finish(handle) elif mode == 'buildinfo': # Builds -> Build Info from resources.libs.gui.build_menu import BuildMenu BuildMenu().build_info(name) elif mode == 'buildpreview': # Builds -> Build Preview from resources.libs.gui.build_menu import BuildMenu BuildMenu().build_video(name) elif mode == 'install': # Builds -> Fresh Install/Standard Install/Apply guifix from resources.libs.wizard import Wizard if action == 'build': Wizard().build(name) elif action == 'gui': Wizard().gui(name) elif action == 'theme': # Builds -> "Your Build" -> "Your Theme" Wizard().theme(name, url) elif mode == 'maint': # Maintenance + Maintenance -> any "Tools" section from resources.libs.gui.maintenance_menu import MaintenanceMenu if name == 'clean': MaintenanceMenu().clean_menu() elif name == 'addon': MaintenanceMenu().addon_menu() elif name == 'misc': MaintenanceMenu().misc_menu() elif name == 'backup': MaintenanceMenu().backup_menu() elif name == 'tweaks': MaintenanceMenu().tweaks_menu() elif name == 'logging': MaintenanceMenu().logging_menu() elif name is None: MaintenanceMenu().get_listing() self._finish(handle) elif mode == 'enableaddons': # Maintenance - > Addon Tools -> Enable/Disable Addons menu.enable_addons() self._finish(handle) elif mode == 'toggleaddon': from resources.libs import db db.toggle_addon(name, url) xbmc.executebuiltin('Container.Refresh()') elif mode == 'forceupdate': from resources.libs import db db.force_check_updates(auto=action) elif mode == 'togglecache': from resources.libs import clear clear.toggle_cache(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'changefreq': # Maintenance - Auto Clean Frequency menu.change_freq() xbmc.executebuiltin('Container.Refresh()') elif mode == 'systeminfo': # Maintenance -> System Tweaks/Fixes -> System Information menu.system_info() self._finish(handle) elif mode == 'nettools': # Maintenance -> Misc Maintenance -> Network Tools menu.net_tools() self._finish(handle) elif mode == 'runspeedtest': # Maintenance -> Misc Maintenance -> Network Tools -> Speed Test -> Run Speed Test menu.run_speed_test() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearspeedtest': # Maintenance -> Misc Maintenance -> Network Tools -> Speed Test -> Clear Results menu.clear_speed_test() xbmc.executebuiltin('Container.Refresh()') elif mode == 'viewspeedtest': # Maintenance -> Misc Maintenance -> Network Tools -> Speed Test -> any previous test menu.view_speed_test(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'viewIP': # Maintenance -> Misc Maintenance -> Network Tools -> View IP Address & MAC Address menu.view_ip() self._finish(handle) elif mode == 'speedtest': # Maintenance -> Misc Maintenance -> Network Tools -> Speed Test menu.speed_test() self._finish(handle) elif mode == 'apk': # APK Installer menu.apk_menu(url) self._finish(handle) elif mode == 'kodiapk': # APK Installer -> Official Kodi APK's xbmc.executebuiltin('RunScript(script.kodi.android.update)') elif mode == 'fmchoose': from resources.libs import install install.choose_file_manager() elif mode == 'apkinstall': from resources.libs import install install.install_apk(name, url) elif mode == 'removeaddondata': # Maintenance - > Addon Tools -> Remove Addon Data menu.remove_addon_data_menu() self._finish(handle) elif mode == 'savedata': # Save Data + Builds -> Save Data Menu menu.save_menu() self._finish(handle) elif mode == 'youtube': # "YouTube Section" menu.youtube_menu(url) self._finish(handle) elif mode == 'viewVideo': # View Video from resources.libs import yt yt.play_video(url) elif mode == 'trakt': # Save Data -> Keep Trakt Data menu.trakt_menu() self._finish(handle) elif mode == 'realdebrid': # Save Data -> Keep Debrid menu.debrid_menu() self._finish(handle) elif mode == 'login': # Save Data -> Keep Login Info menu.login_menu() self._finish(handle) elif mode == 'developer': # Developer Menu menu.developer() self._finish(handle) # MAINTENANCE FUNCTIONS elif mode == 'kodi17fix': # Misc Maintenance -> Kodi 17 Fix from resources.libs import db db.kodi_17_fix() elif mode == 'unknownsources': # Misc Maintenance -> Enable Unknown Sources from resources.libs import skin skin.swap_us() elif mode == 'enabledebug': # Misc Maintenance -> Enable Debug Logging logging.swap_debug() elif mode == 'toggleupdates': # Misc Maintenance -> Toggle Addon Updates from resources.libs import update update.toggle_addon_updates() elif mode == 'asciicheck': # System Tweaks -> Scan for Non-Ascii Files from resources.libs.common import tools tools.ascii_check() elif mode == 'convertpath': # System Tweaks -> Convert Special Paths from resources.libs.common import tools tools.convert_special(CONFIG.HOME) elif mode == 'forceprofile': # Misc Maintenance -> Reload Profile from resources.libs.common import tools tools.reload_profile(tools.get_info_label('System.ProfileName')) elif mode == 'forceclose': # Misc Maintenance -> Force Close Kodi from resources.libs.common import tools tools.kill_kodi() elif mode == 'forceskin': # Misc Maintenance -> Reload Skin xbmc.executebuiltin("ReloadSkin()") xbmc.executebuiltin('Container.Refresh()') # elif mode == 'hidepassword': # Addon Tools -> Hide Passwords on Keyboard Entry # from resources.libs import db # db.hide_password() # elif mode == 'unhidepassword': # Addon Tools -> Unhide Passwords on Keyboard Entry # from resources.libs import db # db.unhide_password() elif mode == 'checksources': # System Tweaks -> Scan source for broken links from resources.libs import check check.check_sources() xbmc.executebuiltin('Container.Refresh()') elif mode == 'checkrepos': # System Tweaks -> Scan for broken repositories from resources.libs import check check.check_repos() xbmc.executebuiltin('Container.Refresh()') elif mode == 'whitelist': # Whitelist Functions from resources.libs import whitelist whitelist.whitelist(name) # CLEANING elif mode == 'oldThumbs': # Cleaning Tools -> Clear Old Thumbnails from resources.libs import clear clear.old_thumbs() elif mode == 'clearbackup': # Backup/Restore -> Clean Up Back Up Folder from resources.libs import backup backup.cleanup_backup() elif mode == 'fullclean': # Cleaning Tools -> Total Cleanup from resources.libs import clear clear.total_clean() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearcache': # Cleaning Tools -> Clear Cache from resources.libs import clear clear.clear_cache() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearfunctioncache': # Cleaning Tools -> Clear Function Caches from resources.libs import clear clear.clear_function_cache() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearpackages': # Cleaning Tools -> Clear Packages from resources.libs import clear clear.clear_packages() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearcrash': # Cleaning Tools -> Clear Crash Logs from resources.libs import clear clear.clear_crash() xbmc.executebuiltin('Container.Refresh()') elif mode == 'clearthumb': # Cleaning Tools -> Clear Thumbnails from resources.libs import clear clear.clear_thumbs() xbmc.executebuiltin('Container.Refresh()') elif mode == 'cleararchive': # Cleaning Tools -> Clear Archive Cache from resources.libs import clear clear.clear_archive() xbmc.executebuiltin('Container.Refresh()') elif mode == 'freshstart': # Cleaning Tools -> Fresh Start from resources.libs import install install.fresh_start() elif mode == 'purgedb': # Cleaning Tools -> Purge Databases from resources.libs import db db.purge_db() elif mode == 'removeaddons': # Addon Tools -> Remove Addons from resources.libs import clear clear.remove_addon_menu() elif mode == 'removedata': # Addon Tools -> Remove Addon Data from resources.libs import clear clear.remove_addon_data(name) elif mode == 'resetaddon': # Addon Tools -> Remove Addon Data -> Remove Wizard Addon Data from resources.libs.common import tools tools.clean_house(CONFIG.ADDON_DATA, ignore=True) logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Addon_Data reset[/COLOR]".format(CONFIG.COLOR2)) # BACKUP / RESTORE elif mode == 'backup' and action: from resources.libs import backup backup.backup(action) elif mode == 'restore' and action: from resources.libs import restore restore.restore(action, external=name == 'external') elif mode == 'wizardupdate': # Wizard Update from resources.libs import update update.wizard_update() # LOGGING elif mode == 'uploadlog': # Upload Log File logging.upload_log() elif mode == 'viewlog': # View kodi.log logging.view_log_file() elif mode == 'viewwizlog': # View wizard.log from resources.libs.gui import window window.show_log_viewer(log_file=CONFIG.WIZLOG) elif mode == 'viewerrorlog': # View errors in log logging.error_checking() elif mode == 'viewerrorlast': # View last error in log logging.error_checking(last=True) elif mode == 'clearwizlog': # Clear wizard.log from resources.libs.common import tools tools.remove_file(CONFIG.WIZLOG) logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE), "[COLOR {0}]Wizard Log Cleared![/COLOR]".format(CONFIG.COLOR2)) # ADVANCED SETTINGS elif mode == advanced_settings_mode: from resources.libs import advanced self.route = advanced.AdvancedMenu() advanced_settings_actions = ['quick_configure', 'view_current', 'remove_current', 'write_advanced', 'set_setting', 'show_section'] category = self.params['category'] if 'category' in self.params else None tag = self.params['tag'] if 'tag' in self.params else None value = self.params['value'] if 'value' in self.params else None tags = self.params['tags'] if 'tags' in self.params else None if not action: self.route.show_menu(url=url) self._finish(handle) elif action == advanced_settings_actions[0]: # Advanced Settings Quick Configure self.route.quick_configure() self._finish(handle) elif action == advanced_settings_actions[1]: # View Current Advanced Settings advanced.view_current() elif action == advanced_settings_actions[2]: # Remove Current Advanced Settings advanced.remove_current() elif action == advanced_settings_actions[3] and url: # Write New Advanced Settings self.route.write_advanced(name, url) elif action == advanced_settings_actions[4]: # Set a Setting self.route.set_setting(category, tag, value) elif action == advanced_settings_actions[5]: # Open a Section self.route.show_section(tags) self._finish(handle) # ADDON INSTALLER elif mode == addon_installer_mode: from resources.libs.gui import addon_menu self.route = addon_menu.AddonMenu() addon_installer_actions = ['addon', 'skin', 'addonpack'] addonurl = self.params['addonurl'] if 'addonurl' in self.params else None repository = self.params['repository'] if 'repository' in self.params else None repositoryurl = self.params['repositoryurl'] if 'repositoryurl' in self.params else None repositoryxml = self.params['repositoryxml'] if 'repositoryxml' in self.params else None urls = [addonurl, repository, repositoryurl, repositoryxml] if not action: self.route.show_menu(url=url) self._finish(handle) elif action == addon_installer_actions[0]: self.route.install_addon(name, urls) elif action == addon_installer_actions[1]: pass # self.route.install_skin(name, url) elif action == addon_installer_actions[2]: pass # self.route.install_addon_pack(name, url) # SAVE DATA elif mode == 'managedata': from resources.libs import save if name == 'import': save.import_save_data() elif name == 'export': save.export_save_data() # TRAKT elif mode == 'savetrakt': # Save Trakt Data from resources.libs import traktit traktit.trakt_it('update', name) elif mode == 'restoretrakt': # Recover All Saved Trakt Data from resources.libs import traktit traktit.trakt_it('restore', name) elif mode == 'addontrakt': # Clear All Addon Trakt Data from resources.libs import traktit traktit.trakt_it('clearaddon', name) elif mode == 'cleartrakt': # Clear All Saved Trakt Data from resources.libs import traktit traktit.clear_saved(name) elif mode == 'authtrakt': # Authorize Trakt from resources.libs import traktit traktit.activate_trakt(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'updatetrakt': # Update Saved Trakt Data from resources.libs import traktit traktit.auto_update('all') elif mode == 'importtrakt': # Import Saved Trakt Data from resources.libs import traktit traktit.import_list(name) xbmc.executebuiltin('Container.Refresh()') # DEBRID elif mode == 'savedebrid': # Save Debrid Data from resources.libs import debridit debridit.debrid_it('update', name) elif mode == 'restoredebrid': # Recover All Saved Debrid Data from resources.libs import debridit debridit.debrid_it('restore', name) elif mode == 'addondebrid': # Clear All Addon Debrid Data from resources.libs import debridit debridit.debrid_it('clearaddon', name) elif mode == 'cleardebrid': # Clear All Saved Debrid Data from resources.libs import debridit debridit.clear_saved(name) elif mode == 'authdebrid': # Authorize Debrid from resources.libs import debridit debridit.activate_debrid(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'updatedebrid': # Update Saved Debrid Data from resources.libs import debridit debridit.auto_update('all') elif mode == 'importdebrid': # Import Saved Debrid Data from resources.libs import debridit debridit.import_list(name) xbmc.executebuiltin('Container.Refresh()') # LOGIN elif mode == 'savelogin': # Save Login Data from resources.libs import loginit loginit.login_it('update', name) elif mode == 'restorelogin': # Recover All Saved Login Data from resources.libs import loginit loginit.login_it('restore', name) elif mode == 'addonlogin': # Clear All Addon Login Data from resources.libs import loginit loginit.login_it('clearaddon', name) elif mode == 'clearlogin': # Clear All Saved Login Data from resources.libs import loginit loginit.clear_saved(name) elif mode == 'authlogin': # "Authorize" Login from resources.libs import loginit loginit.activate_login(name) xbmc.executebuiltin('Container.Refresh()') elif mode == 'updatelogin': # Update Saved Login Data from resources.libs import loginit loginit.auto_update('all') elif mode == 'importlogin': # Import Saved Login Data from resources.libs import loginit loginit.import_list(name) xbmc.executebuiltin('Container.Refresh()') # DEVELOPER MENU elif mode == 'createqr': # Developer Menu -> Create QR Code from resources.libs import qr qr.create_code() elif mode == 'testnotify': # Developer Menu -> Test Notify from resources.libs import test test.test_notify() elif mode == 'testupdate': # Developer Menu -> Test Update from resources.libs import test test.test_update() elif mode == 'testsavedata': # Developer Menu -> Test Save Data Settings from resources.libs import test test.test_save_data_settings() elif mode == 'testbuildprompt': # Developer Menu -> Test Build Prompt from resources.libs import test test.test_first_run() elif mode == 'binarycheck': from resources.libs import db db.find_binary_addons() elif mode == 'contact': # Contact from resources.libs.gui import window window.show_contact(CONFIG.CONTACT)
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 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 fresh_start(install=None, over=False): from resources.libs.common import logging from resources.libs.common import tools dialog = xbmcgui.Dialog() 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))) if over: yes_pressed = 1 elif install == 'restore': yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Do you wish to restore your".format(CONFIG.COLOR2), "Kodi configuration to default settings", "Before installing the local backup?[/COLOR]", nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Continue[/COLOR][/B]') elif install: yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Do you wish to restore your".format(CONFIG.COLOR2), "Kodi configuration to default settings", "Before installing [COLOR {0}]{1}[/COLOR]?".format( CONFIG.COLOR1, install), nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Continue[/COLOR][/B]') else: yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Do you wish to restore your".format(CONFIG.COLOR2), "Kodi configuration to default settings?[/COLOR]", nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Continue[/COLOR][/B]') if yes_pressed: wipe() if over: return True elif install == 'restore': return True elif install: from resources.libs.wizard import Wizard Wizard().build('normal', install, over=True) else: 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)) from resources.libs import update update.addon_updates('reset') tools.kill_kodi(over=True) else: if not install == 'restore': logging.log_notify( CONFIG.ADDONTITLE, '[COLOR {0}]Fresh Install: Cancelled![/COLOR]'.format( CONFIG.COLOR2)) xbmc.executebuiltin('Container.Refresh()')
def fresh_start(install=None, over=False): from resources.libs.common import logging from resources.libs.common import tools dialog = xbmcgui.Dialog() 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))) if over: yes_pressed = 1 elif install == 'restore': yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Desea restaurar su".format(CONFIG.COLOR2) + '\n' + "Configuración de Kodi a la configuración predeterminada" + '\n' + "¿Antes de instalar la copia de seguridad local?[/COLOR]", nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]', yeslabel='[B][COLOR cyan]Continuar[/COLOR][/B]') elif install: yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Desea restaurar su".format(CONFIG.COLOR2) + '\n' + "Configuración de Kodi a la configuración predeterminada" + '\n' + "Antes de instalar [COLOR {0}]{1}[/COLOR]?".format( CONFIG.COLOR1, install), nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]', yeslabel='[B][COLOR cyan]Continuar[/COLOR][/B]') else: yes_pressed = dialog.yesno( CONFIG.ADDONTITLE, "[COLOR {0}]Desea restaurar su".format(CONFIG.COLOR2) + ' \n' + "Configuración de Kodi a la configuración predeterminada[/COLOR]", nolabel='[B][COLOR red]No, Cancelar[/COLOR][/B]', yeslabel='[B][COLOR cyan]Continuar[/COLOR][/B]') if yes_pressed: wipe() if over: return True elif install == 'restore': return True elif install: from resources.libs.wizard import Wizard Wizard().build('normal', install, over=True) else: 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)) from resources.libs import update update.addon_updates('reset') tools.kill_kodi(over=True) else: if not install == 'restore': logging.log_notify( CONFIG.ADDONTITLE, '[COLOR {0}]Instalación Nueva: Cancelada![/COLOR]'.format( CONFIG.COLOR2)) xbmc.executebuiltin('Container.Refresh()')
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 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))