def tweaks_menu(self): # LEAVING OUT ADVANCED SETTINGS FOR NOW # # if not CONFIG.ADVANCEDFILE == 'http://' and not CONFIG.ADVANCEDFILE == '': # directory.add_dir('Advanced Settings', 'advancedsetting', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) # else: # if os.path.exists(CONFIG.ADVANCED): # directory.add_file('View Current AdvancedSettings.xml', 'currentsettings', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) # directory.add_file('Remove Current AdvancedSettings.xml', 'removeadvanced', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) # directory.add_file('Quick Configure AdvancedSettings.xml', 'autoadvanced', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Scan Sources for broken links', {'mode': 'checksources'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Scan For Broken Repositories', {'mode': 'checkrepos'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Remove Non-Ascii filenames', {'mode': 'asciicheck'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Convert Paths to special', {'mode': 'convertpath'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_dir('System Information', {'mode': 'systeminfo'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
def get_listing(self): directory.add_dir('[B]Cleaning Tools[/B]', { 'mode': 'maint', 'name': 'clean' }, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_dir('[B]Addon Tools[/B]', { 'mode': 'maint', 'name': 'addon' }, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_dir('[B]Misc Maintenance[/B]', { 'mode': 'maint', 'name': 'misc' }, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_dir('[B]Back up/Restore[/B]', { 'mode': 'maint', 'name': 'backup' }, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_dir('[B]System Tweaks/Fixes[/B]', { 'mode': 'maint', 'name': 'tweaks' }, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1)
def misc_menu(self): from resources.libs.common import logging from resources.libs.common import tools errors = int(logging.error_checking(count=True)) errorsfound = str( errors) + ' Error(s) Found' if errors > 0 else 'None Found' wizlogsize = ': [COLOR red]Not Found[/COLOR]' if not os.path.exists( CONFIG.WIZLOG) else ": [COLOR springgreen]{0}[/COLOR]".format( tools.convert_size(os.path.getsize(CONFIG.WIZLOG))) directory.add_file('Kodi 17 Fix', {'mode': 'kodi17fix'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_dir('Network Tools', {'mode': 'nettools'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Toggle Unknown Sources', {'mode': 'unknownsources'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Toggle Debug Logging', {'mode': 'enabledebug'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Toggle Addon Updates', {'mode': 'toggleupdates'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Reload Skin', {'mode': 'forceskin'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Reload Profile', {'mode': 'forceprofile'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Force Close Kodi', {'mode': 'forceclose'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Upload Log File', {'mode': 'uploadlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file( 'View Errors in Log: [COLOR springgreen][B]{0}[/B][/COLOR]'.format( errorsfound), {'mode': 'viewerrorlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) if errors > 0: directory.add_file('View Last Error In Log', {'mode': 'viewerrorlast'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('View Log File', {'mode': 'viewlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('View Wizard Log File', {'mode': 'viewwizlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file( 'Clear Wizard Log File: [COLOR springgreen][B]{0}[/B][/COLOR]'. format(wizlogsize), {'mode': 'clearwizlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
def addon_menu(self): directory.add_file('Remove Addons', {'mode': 'removeaddons'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_dir('Remove Addon Data', {'mode': 'removeaddondata'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_dir('Enable/Disable Addons', {'mode': 'enableaddons'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) # directory.add_file('Enable/Disable Adult Addons', 'toggleadult', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3) directory.add_file('Check for Addon Updates', {'mode': 'forceupdate'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
def _list_all(self, match, kodiv=None): from resources.libs import test for name, version, url, gui, kodi, theme, icon, fanart, adult, description in match: if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes': continue if not CONFIG.DEVELOPER == 'true' and test.str_test(name): continue if not kodiv or kodiv == int(float(kodi)): menu = self.create_install_menu(name) directory.add_dir('[{0}] {1} (v{2})'.format( float(kodi), name, version), { 'mode': 'viewbuild', 'name': name }, description=description, fanart=fanart, icon=icon, menu=menu, themeit=CONFIG.THEME2)
def get_listing(self): from resources.libs import check from resources.libs.common import logging from resources.libs.common import tools errors = int(logging.error_checking(count=True)) errorsfound = str( errors) + ' Error(s) Found' if errors > 0 else 'None Found' if CONFIG.AUTOUPDATE == 'Yes': response = tools.open_url(CONFIG.BUILDFILE, check=True) if response: ver = check.check_wizard('version') if ver: if ver > CONFIG.ADDON_VERSION: directory.add_file( '{0} [v{1}] [COLOR red][B][UPDATE v{2}][/B][/COLOR]' .format(CONFIG.ADDONTITLE, CONFIG.ADDON_VERSION, ver), {'mode': 'wizardupdate'}, themeit=CONFIG.THEME2) else: directory.add_file('{0} [v{1}]'.format( CONFIG.ADDONTITLE, CONFIG.ADDON_VERSION), themeit=CONFIG.THEME2) else: directory.add_file('{0} [v{1}]'.format(CONFIG.ADDONTITLE, CONFIG.ADDON_VERSION), themeit=CONFIG.THEME2) else: directory.add_file('{0} [v{1}]'.format(CONFIG.ADDONTITLE, CONFIG.ADDON_VERSION), themeit=CONFIG.THEME2) if len(CONFIG.BUILDNAME) > 0: version = check.check_build(CONFIG.BUILDNAME, 'version') build = '{0} (v{1})'.format(CONFIG.BUILDNAME, CONFIG.BUILDVERSION) if version > CONFIG.BUILDVERSION: build = '{0} [COLOR red][B][UPDATE v{1}][/B][/COLOR]'.format( build, version) directory.add_dir(build, { 'mode': 'viewbuild', 'name': CONFIG.BUILDNAME }, themeit=CONFIG.THEME4) from resources.libs.gui.build_menu import BuildMenu themefile = BuildMenu().theme_count(CONFIG.BUILDNAME) if themefile: directory.add_file( 'None' if CONFIG.BUILDTHEME == "" else CONFIG.BUILDTHEME, { 'mode': 'theme', 'name': CONFIG.BUILDNAME }, themeit=CONFIG.THEME5) else: directory.add_dir('None', {'mode': 'builds'}, themeit=CONFIG.THEME4) directory.add_separator() directory.add_dir('Builds', {'mode': 'builds'}, icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME1) directory.add_dir('Maintenance', {'mode': 'maint'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) if (tools.platform() == 'android' or CONFIG.DEVELOPER == 'true') and CONFIG.KODIV < 18: directory.add_dir('APK Installer', {'mode': 'apk'}, icon=CONFIG.ICONAPK, themeit=CONFIG.THEME1) if tools.open_url(CONFIG.ADDONFILE, check=True): directory.add_dir('Addon Installer', {'mode': 'addons'}, icon=CONFIG.ICONADDONS, themeit=CONFIG.THEME1) if tools.open_url(CONFIG.YOUTUBEFILE, check=True) and not CONFIG.YOUTUBETITLE == '': directory.add_dir(CONFIG.YOUTUBETITLE, {'mode': 'youtube'}, icon=CONFIG.ICONYOUTUBE, themeit=CONFIG.THEME1) directory.add_dir('Save Data', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1) if CONFIG.HIDECONTACT == 'No': directory.add_file('Contact', {'mode': 'contact'}, icon=CONFIG.ICONCONTACT, themeit=CONFIG.THEME1) directory.add_separator() directory.add_file('Upload Log File', {'mode': 'uploadlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_file('View Errors in Log: {0}'.format(errorsfound), {'mode': 'viewerrorlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) if errors > 0: directory.add_file('View Last Error In Log', {'mode': 'viewerrorlast'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1) directory.add_separator() directory.add_file('Settings', { 'mode': 'settings', 'name': CONFIG.ADDON_ID }, icon=CONFIG.ICONSETTINGS, themeit=CONFIG.THEME1) if CONFIG.DEVELOPER == 'true': directory.add_dir('Developer Menu', {'mode': 'developer'}, icon=CONFIG.ADDON_ICON, themeit=CONFIG.THEME1)
def get_listing(self): from resources.libs import test # if BUILDFILE is a bad URL if not self.bf: directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3) directory.add_separator() directory.add_file('URL for txt file not valid', icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) directory.add_file('{0}'.format(CONFIG.BUILDFILE), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) return total, count17, count18, count19, adultcount, hidden = check.build_count( ) match = re.compile( 'name="(.+?)".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"' ).findall(self.link) if total == 1: for name, version, url, gui, kodi, theme, icon, fanart, adult, description in match: if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes': continue if not CONFIG.DEVELOPER == 'true' and test.str_test(name): continue self.view_build(match[0][0]) return directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3) directory.add_separator() if len(match) >= 1: if CONFIG.SEPARATE == 'true': self._list_all(match) else: if count19 > 0: state = '+' if CONFIG.SHOW19 == 'false' else '-' directory.add_file('[B]{0} Matrix Builds ({1})[/B]'.format( state, count19), { 'mode': 'togglesetting', 'name': 'show19' }, themeit=CONFIG.THEME3) if CONFIG.SHOW19 == 'true': self._list_all(match, kodiv=19) if count18 > 0: state = '+' if CONFIG.SHOW18 == 'false' else '-' directory.add_file('[B]{0} Leia Builds ({1})[/B]'.format( state, count18), { 'mode': 'togglesetting', 'name': 'show18' }, themeit=CONFIG.THEME3) if CONFIG.SHOW18 == 'true': self._list_all(match, kodiv=18) if count17 > 0: state = '+' if CONFIG.SHOW17 == 'false' else '-' directory.add_file( '[B]{0} Krypton Builds ({1})[/B]'.format( state, count17), { 'mode': 'togglesetting', 'name': 'show17' }, themeit=CONFIG.THEME3) if CONFIG.SHOW17 == 'true': self._list_all(match, kodiv=17) elif hidden > 0: if adultcount > 0: directory.add_file('There is currently only Adult builds', icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) directory.add_file( 'Enable Show Adults in Addon Settings > Misc', icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) else: directory.add_file( 'Currently No Builds Offered from {0}'.format( CONFIG.ADDONTITLE), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3) else: directory.add_file('Text file for builds not formatted correctly.', icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3)
def view_build(self, name): if not self.bf: directory.add_file('URL for txt file not valid', themeit=CONFIG.THEME3) directory.add_file('{0}'.format(CONFIG.BUILDFILE), themeit=CONFIG.THEME3) return if not check.check_build(name, 'version'): directory.add_file('Error reading the txt file.', themeit=CONFIG.THEME3) directory.add_file( '{0} was not found in the builds list.'.format(name), themeit=CONFIG.THEME3) return match = re.compile( 'name="%s".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?review="(.+?)".+?dult="(.+?)".+?nfo="(.+?)".+?escription="(.+?)"' % name).findall(self.link) for version, url, gui, kodi, themefile, icon, fanart, preview, adult, info, description in match: build = '{0} (v{1})'.format(name, version) updatecheck = CONFIG.BUILDNAME == name and version > CONFIG.BUILDVERSION versioncheck = True if float( CONFIG.KODIV) == float(kodi) else False previewcheck = tools.open_url(preview, check=True) guicheck = tools.open_url(gui, check=True) themecheck = tools.open_url(themefile, check=True) if updatecheck: build = '{0} [COLOR red][CURRENT v{1}][/COLOR]'.format( build, CONFIG.BUILDVERSION) directory.add_file(build, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME4) directory.add_separator() directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3) directory.add_file('Build Information', { 'mode': 'buildinfo', 'name': name }, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME3) if previewcheck: directory.add_file('View Video Preview', { 'mode': 'buildpreview', 'name': name }, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME3) if versioncheck: directory.add_file( '[I]Build designed for Kodi v{0} (installed: v{1})[/I]'. format(str(kodi), str(CONFIG.KODIV)), fanart=fanart, icon=icon, themeit=CONFIG.THEME3) directory.add_separator('INSTALL') directory.add_file('Fresh Install', { 'mode': 'install', 'name': name, 'action': 'fresh' }, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME1) directory.add_file('Standard Install', { 'mode': 'install', 'name': name, 'action': 'normal' }, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME1) if guicheck: directory.add_file('Apply guiFix', { 'mode': 'install', 'name': name, 'action': 'gui' }, description=description, fanart=fanart, icon=icon, themeit=CONFIG.THEME1) if themecheck: directory.add_separator('THEMES', fanart=fanart, icon=icon) response = tools.open_url(themefile) theme = response.text link = tools.clean_text(theme) match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"' ).findall(link) for themename, themeurl, themeicon, themefanart, themeadult, description in match: adultcheck = CONFIG.SHOWADULT != 'true' and themeadult.lower( ) == 'yes' if adultcheck: continue themetitle = themename if not themename == CONFIG.BUILDTHEME else "[B]{0} (Installed)[/B]".format( themename) themeicon = themeicon if tools.open_url( themeicon, check=True) else icon themefanart = themefanart if tools.open_url( themefanart, check=True) else fanart directory.add_file(themetitle, { 'mode': 'install', 'name': name, 'url': themename, 'action': 'theme' }, description=description, fanart=themefanart, icon=themeicon, themeit=CONFIG.THEME3)