Example #1
0
 def misc_menu(self):
     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 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)
    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) or os.path.exists(
                os.path.join(CONFIG.ADDON_PATH, 'resources', 'text',
                             'addons.json')):
            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)
Example #3
0
    def logging_menu(self):
        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 deepskyblue]{0}[/COLOR]".format(
                tools.convert_size(os.path.getsize(CONFIG.WIZLOG)))

        directory.add_file('Toggle Debug Logging', {'mode': 'enabledebug'},
                           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 deepskyblue][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 deepskyblue][B]{0}[/B][/COLOR]'.
            format(wizlogsize), {'mode': 'clearwizlog'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
Example #4
0
 def misc_menu(self):
     directory.add_file('Kodi 17 Fix', {'mode': 'kodi17fix'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_dir('Herramientas de red', {'mode': 'nettools'},
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
     directory.add_file('Alternar fuentes desconocidas',
                        {'mode': 'unknownsources'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('Alternar actualizaciones de complementos',
                        {'mode': 'toggleupdates'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('Recargar Skin', {'mode': 'forceskin'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('Recargar Profile', {'mode': 'forceprofile'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('forzar cierre de Kodi', {'mode': 'forceclose'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
Example #5
0
 def show_menu(self, url=None):
     oo0Ooo0 = tools.open_url(CONFIG.ADDONFILE)
     I1I11I1I1I = tools.open_url(url)
     OooO0OO = os.path.join(CONFIG.ADDON_PATH, 'resources', 'text',
                            'addons.json')
     if 28 - 28: II111iiii
     if I1I11I1I1I:
         iii11iII = I1I11I1I1I.text
     elif oo0Ooo0:
         iii11iII = oo0Ooo0.text
     elif os.path.exists(OooO0OO):
         iii11iII = tools.read_from_file(OooO0OO)
     else:
         iii11iII = None
         logging.log("[Menu Addon] Nenhuma lista Addon adicionada.")
         if 42 - 42: I1i1iI1i + I1ii11iIi11i
     if iii11iII:
         import json
         if 70 - 70:
             Oo0Ooo % Oo0Ooo.Oo0ooO0oo0oO % OoO0O00 * o0oOOo0O0Ooo % oO0o
         try:
             iiI1IiI = json.loads(iii11iII)
         except:
             iiI1IiI = None
             logging.log(
                 "[Configurações avançadas] ERRO: Formato inválido para {0}."
                 .format(iii11iII))
             if 13 - 13: Oo0Ooo.i11iIiiIii - iIii1I11I1II1 - OoOoOO00
         if iiI1IiI:
             ii1I = iiI1IiI['addons']
             if 76 - 76: O0 / o0oOOo0O0Ooo.I1IiiI * Ii1I - OOooOOo
             if ii1I and len(ii1I) > 0:
                 for Oooo in ii1I:
                     O00o = Oooo.get('name', '')
                     type = Oooo.get('type', 'addon')
                     O00 = Oooo.get('section', False)
                     i11I1 = Oooo.get('plugin', '')
                     Ii11Ii11I = Oooo.get('url', '')
                     iI11i1I1 = Oooo.get('repository', '')
                     o0o0OOO0o0 = Oooo.get('repositoryxml', '')
                     ooOOOo0oo0O0 = Oooo.get('repositoryurl', '')
                     i1i1II = Oooo.get('icon', CONFIG.ADDON_ICON)
                     o0 = Oooo.get('fanart', CONFIG.ADDON_FANART)
                     I11II1i = Oooo.get('adult', False)
                     IIIII = Oooo.get('description', '')
                     if 75 - 75: II111iiii % II111iiii
                     if not O00o:
                         logging.log(
                             '[Configurações avançadas] Tag ausente \'name\'',
                             level=xbmc.LOGDEBUG)
                         continue
                         if 13 - 13: o0oOOo0O0Ooo.Ii1I
                     if not Ii11Ii11I:
                         logging.log(
                             '[Configurações avançadas] Tag ausente \'url\'',
                             level=xbmc.LOGDEBUG)
                         continue
                     else:
                         if '.zip' in Ii11Ii11I:
                             pass
                         elif not O00:
                             i11Iiii = False
                             if not iI11i1I1:
                                 logging.log(
                                     '[Configurações avançadas] Tag ausente \'repository\'',
                                     level=xbmc.LOGDEBUG)
                                 i11Iiii = True
                             if not o0o0OOO0o0:
                                 logging.log(
                                     '[Configurações avançadas] Tag ausente \'repositoryxml\'',
                                     level=xbmc.LOGDEBUG)
                                 i11Iiii = True
                             if not ooOOOo0oo0O0:
                                 logging.log(
                                     '[Configurações avançadas] Tag ausente \'repositoryurl\'',
                                     level=xbmc.LOGDEBUG)
                                 i11Iiii = True
                             if i11Iiii:
                                 continue
                                 if 23 - 23: o0oOOo0O0Ooo.II111iiii
                     if O00:
                         directory.add_dir(O00o, {
                             'mode': 'addons',
                             'url': Ii11Ii11I
                         },
                                           description=IIIII,
                                           icon=i1i1II,
                                           fanart=o0,
                                           themeit=CONFIG.THEME3)
                     else:
                         if not CONFIG.SHOWADULT == 'true' and I11II1i:
                             continue
                             if 98 - 98:
                                 iIii1I11I1II1 % OoOoOO00 * I1ii11iIi11i * OoOoOO00
                         if type.lower() == 'skin':
                             directory.add_file(O00o, {
                                 'mode': 'addons',
                                 'action': 'skin',
                                 'name': O00o,
                                 'url': Ii11Ii11I
                             },
                                                description=IIIII,
                                                icon=i1i1II,
                                                fanart=o0,
                                                themeit=CONFIG.THEME2)
                         elif type.lower() == 'addonpack':
                             directory.add_file(O00o, {
                                 'mode': 'addons',
                                 'action': 'addonpack',
                                 'name': O00o,
                                 'url': Ii11Ii11I
                             },
                                                description=IIIII,
                                                icon=i1i1II,
                                                fanart=o0,
                                                themeit=CONFIG.THEME2)
                         else:
                             try:
                                 i1 = tools.get_addon_info(i11I1, 'path')
                                 if os.path.exists(i1):
                                     O00o = "[COLOR springgreen][Instalado][/COLOR] {0}".format(
                                         O00o)
                             except:
                                 pass
                                 if 48 - 48:
                                     O0 + O0 - I1ii11iIi11i.o00ooo0 / iIii1I11I1II1
                             directory.add_file(
                                 O00o, {
                                     'mode': 'addons',
                                     'action': 'addon',
                                     'name': i11I1,
                                     'addonurl': Ii11Ii11I,
                                     'repository': iI11i1I1,
                                     'repositoryxml': o0o0OOO0o0,
                                     'repositoryurl': ooOOOo0oo0O0
                                 },
                                 description=IIIII,
                                 icon=i1i1II,
                                 fanart=o0,
                                 themeit=CONFIG.THEME2)
             else:
                 if not ii1I:
                     directory.add_file(
                         'Arquivo de texto não formatado corretamente!',
                         themeit=CONFIG.THEME3)
                     logging.log("[Menu Addon] ERRO: Formato inválido.")
                 elif len(ii1I) == 0:
                     directory.add_file(
                         "Nenhum complemento adicionado a este menu ainda!",
                         themeit=CONFIG.THEME2)
     else:
         logging.log(
             "[Menu Addon] ERRO: URL para a lista Addon não funciona.")
         directory.add_file('O URL do arquivo txt não é válido',
                            themeit=CONFIG.THEME3)
         directory.add_file('{0}'.format(CONFIG.ADDONFILE),
                            themeit=CONFIG.THEME3)
         if 77 - 77: i1IIi % OoOoOO00 - Oo0ooO0oo0oO + o00ooo0
    def view_build(self, name):
    
        response = tools.open_url(CONFIG.BUILDFILE)
        
        if response:
            link = tools.clean_text(response.text)
        else:
            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(
            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('Install', {'mode': 'install', 'action': 'build', 'name': name}, description=description, fanart=fanart,
                               icon=icon, themeit=CONFIG.THEME1)
                               
            if guicheck:
                directory.add_file('Apply guiFix', {'mode': 'install', 'action': 'gui', 'name': name}, 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
                themelink = tools.clean_text(theme)
                match = re.compile('name="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"').findall(themelink)
                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', 'action': 'theme', 'name': name, 'url': themename}, description=description, fanart=themefanart,
                        icon=themeicon, themeit=CONFIG.THEME3)
    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)
Example #8
0
def debrid_menu():
    from resources.libs import debridit

    keep_debrid = '[COLOR springgreen]ON[/COLOR]' if CONFIG.KEEPDEBRID == 'true' else '[COLOR red]OFF[/COLOR]'
    last = str(CONFIG.DEBRIDSAVE) if not CONFIG.DEBRIDSAVE == '' else 'Debrid authorizations haven\'t been saved yet.'
    directory.add_file('[I]https://www.real-debrid.com/ is a PAID service.[/I]', icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('[I]https://www.premiumize.me/ is a PAID service.[/I]', icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('Save Debrid Data: {0}'.format(keep_debrid), {'mode': 'togglesetting', 'name': 'keepdebrid'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    if CONFIG.KEEPDEBRID == 'true':
        directory.add_file('Last Save: {0}'.format(str(last)), icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_separator(icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)

    for debrid in debridit.ORDER:
        if xbmc.getCondVisibility('System.HasAddon({0})'.format(debridit.DEBRIDID[debrid]['plugin'])):
            name = debridit.DEBRIDID[debrid]['name']
            path = debridit.DEBRIDID[debrid]['path']
            saved = debridit.DEBRIDID[debrid]['saved']
            file = debridit.DEBRIDID[debrid]['file']
            user = CONFIG.get_setting(saved)
            auser = debridit.debrid_user(debrid)
            icon = debridit.DEBRIDID[debrid]['icon'] if os.path.exists(path) else CONFIG.ICONDEBRID
            fanart = debridit.DEBRIDID[debrid]['fanart'] if os.path.exists(path) else CONFIG.ADDON_FANART
            menu = create_addon_data_menu('Debrid', debrid)
            menu2 = create_save_data_menu('Debrid', debrid)
            menu.append((CONFIG.THEME2.format('{0} Settings'.format(name)), 'RunPlugin(plugin://{0}/?mode=opensettings&name={1}&url=debrid)'.format(CONFIG.ADDON_ID, debrid)))

            directory.add_file('[+]-> {0}'.format(name), icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
            if not os.path.exists(path):
                directory.add_file('[COLOR red]Addon Data: Not Installed[/COLOR]', icon=icon, fanart=fanart, menu=menu)
            elif not auser:
                directory.add_file('[COLOR red]Addon Data: Not Registered[/COLOR]', {'mode': 'authdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu)
            else:
                directory.add_file('[COLOR springgreen]Addon Data: {0}[/COLOR]'.format(auser), {'mode': 'authdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu)
            if user == "":
                if os.path.exists(file):
                    directory.add_file('[COLOR red]Saved Data: Save File Found (Import Data)[/COLOR]', {'mode': 'importdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu2)
                else:
                    directory.add_file('[COLOR red]Saved Data: Not Saved[/COLOR]', {'mode': 'savedebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu2)
            else:
                directory.add_file('[COLOR springgreen]Saved Data: {0}[/COLOR]'.format(user), icon=icon, fanart=fanart, menu=menu2)

    directory.add_separator(themeit=CONFIG.THEME3)
    directory.add_file('Save All Debrid Data', {'mode': 'savedebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('Recover All Saved Debrid Data', {'mode': 'restoredebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('Import Debrid Data', {'mode': 'importdebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Addon Debrid Data', {'mode': 'addondebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Saved Debrid Data', {'mode': 'cleardebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
Example #9
0
def login_menu():
    from resources.libs import loginit

    keep_login = '******' if CONFIG.KEEPLOGIN == 'true' else '[COLOR red]OFF[/COLOR]'
    last = str(CONFIG.LOGINSAVE) if not CONFIG.LOGINSAVE == '' else 'Login data hasn\'t been saved yet.'
    directory.add_file('[I]Several of these addons are PAID services.[/I]', icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_file('Save API Keys: {0}'.format(keep_login), {'mode': 'togglesetting', 'name': 'keeplogin'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    if CONFIG.KEEPLOGIN == 'true':
        directory.add_file('Last Save: {0}'.format(str(last)), icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_separator(icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)

    for login in loginit.ORDER:
        if xbmc.getCondVisibility('System.HasAddon({0})'.format(loginit.LOGINID[login]['plugin'])):
            name = loginit.LOGINID[login]['name']
            path = loginit.LOGINID[login]['path']
            saved = loginit.LOGINID[login]['saved']
            file = loginit.LOGINID[login]['file']
            user = CONFIG.get_setting(saved)
            auser = loginit.login_user(login)
            icon = loginit.LOGINID[login]['icon'] if os.path.exists(path) else CONFIG.ICONLOGIN
            fanart = loginit.LOGINID[login]['fanart'] if os.path.exists(path) else CONFIG.ADDON_FANART
            menu = create_addon_data_menu('Login', login)
            menu2 = create_save_data_menu('Login', login)
            menu.append((CONFIG.THEME2.format('{0} Settings'.format(name)), 'RunPlugin(plugin://{0}/?mode=opensettings&name={1}&url=login)'.format(CONFIG.ADDON_ID, login)))

            directory.add_file('[+]-> {0}'.format(name), icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
            if not os.path.exists(path):
                directory.add_file('[COLOR red]Addon Data: Not Installed[/COLOR]', icon=icon, fanart=fanart, menu=menu)
            elif not auser:
                directory.add_file('[COLOR red]Addon Data: Not Registered[/COLOR]', {'mode': 'authlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu)
            else:
                directory.add_file('[COLOR springgreen]Addon Data: {0}[/COLOR]'.format(auser), {'mode': 'authlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu)
            if user == "":
                if os.path.exists(file):
                    directory.add_file('[COLOR red]Saved Data: Save File Found (Import Data)[/COLOR]', {'mode': 'importlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu2)
                else:
                    directory.add_file('[COLOR red]Saved Data: Not Saved[/COLOR]', {'mode': 'savelogin', 'name': login}, icon=icon, fanart=fanart, menu=menu2)
            else:
                directory.add_file('[COLOR springgreen]Saved Data: {0}[/COLOR]'.format(user), icon=icon, fanart=fanart, menu=menu2)

    directory.add_separator(themeit=CONFIG.THEME3)
    directory.add_file('Save All Login Info', {'mode': 'savelogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_file('Recover All Saved Login Info', {'mode': 'restorelogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_file('Import Login Info', {'mode': 'importlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Addon Login Info', {'mode': 'addonlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Saved Login Info', {'mode': 'clearlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)
Example #10
0
def save_menu():
    on = '[COLOR springgreen]ON[/COLOR]'
    off = '[COLOR red]OFF[/COLOR]'

    trakt = 'true' if CONFIG.KEEPTRAKT == 'true' else 'false'
    debrid = 'true' if CONFIG.KEEPDEBRID == 'true' else 'false'
    login = '******' if CONFIG.KEEPLOGIN == 'true' else 'false'
    sources = 'true' if CONFIG.KEEPSOURCES == 'true' else 'false'
    advanced = 'true' if CONFIG.KEEPADVANCED == 'true' else 'false'
    profiles = 'true' if CONFIG.KEEPPROFILES == 'true' else 'false'
    playercore = 'true' if CONFIG.KEEPPLAYERCORE == 'true' else 'false'
    guisettings = 'true' if CONFIG.KEEPGUISETTINGS == 'true' else 'false'
    favourites = 'true' if CONFIG.KEEPFAVS == 'true' else 'false'
    repos = 'true' if CONFIG.KEEPREPOS == 'true' else 'false'
    super = 'true' if CONFIG.KEEPSUPER == 'true' else 'false'
    whitelist = 'true' if CONFIG.KEEPWHITELIST == 'true' else 'false'

    directory.add_dir('Keep Trakt Data', {'mode': 'trakt'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME1)
    directory.add_dir('Keep Debrid', {'mode': 'realdebrid'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME1)
    directory.add_dir('Keep Login Info', {'mode': 'login'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME1)
    directory.add_file('Import Save Data', {'mode': 'managedata', 'name': 'import'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Export Save Data', {'mode': 'managedata', 'name': 'export'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('- Click to toggle settings -', themeit=CONFIG.THEME3)
    directory.add_file('Save Trakt: {0}'.format(trakt.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keeptrakt'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME1)
    directory.add_file('Save Debrid: {0}'.format(debrid.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepdebrid'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME1)
    directory.add_file('Save Login Info: {0}'.format(login.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keeplogin'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'Sources.xml\': {0}'.format(sources.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepsources'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'Profiles.xml\': {0}'.format(profiles.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepprofiles'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'playercorefactory.xml\': {0}'.format(playercore.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepplayercore'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'guisettings.xml\': {0}'.format(guisettings.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepguiseettings'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'Advancedsettings.xml\': {0}'.format(advanced.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepadvanced'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep \'Favourites.xml\': {0}'.format(favourites.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepfavourites'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep Super Favourites: {0}'.format(super.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepsuper'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep Installed Repo\'s: {0}'.format(repos.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keeprepos'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    directory.add_file('Keep My \'WhiteList\': {0}'.format(whitelist.replace('true', on).replace('false', off)), {'mode': 'togglesetting', 'name': 'keepwhitelist'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
    if whitelist == 'true':
        directory.add_file('Edit My Whitelist', {'mode': 'whitelist', 'name': 'edit'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
        directory.add_file('View My Whitelist', {'mode': 'whitelist', 'name': 'view'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
        directory.add_file('Clear My Whitelist', {'mode': 'whitelist', 'name': 'clear'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
        directory.add_file('Import My Whitelist', {'mode': 'whitelist', 'name': 'import'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
        directory.add_file('Export My Whitelist', {'mode': 'whitelist', 'name': 'export'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
Example #11
0
def trakt_menu():
    from resources.libs import traktit

    keep_trakt = '[COLOR springgreen]ON[/COLOR]' if CONFIG.KEEPTRAKT == 'true' else '[COLOR red]OFF[/COLOR]'
    last = str(CONFIG.TRAKTSAVE) if not CONFIG.TRAKTSAVE == '' else 'Trakt hasn\'t been saved yet.'
    directory.add_file('[I]Register FREE Account at https://www.trakt.tv/[/I]', icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_file('Save Trakt Data: {0}'.format(keep_trakt), {'mode': 'togglesetting', 'name': 'keeptrakt'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    if CONFIG.KEEPTRAKT == 'true':
        directory.add_file('Last Save: {0}'.format(str(last)), icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_separator(icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)

    for trakt in traktit.ORDER:
        if xbmc.getCondVisibility('System.HasAddon({0})'.format(traktit.TRAKTID[trakt]['plugin'])):
            name = traktit.TRAKTID[trakt]['name']
            path = traktit.TRAKTID[trakt]['path']
            saved = traktit.TRAKTID[trakt]['saved']
            file = traktit.TRAKTID[trakt]['file']
            user = CONFIG.get_setting(saved)
            auser = traktit.trakt_user(trakt)
            icon = traktit.TRAKTID[trakt]['icon'] if os.path.exists(path) else CONFIG.ICONTRAKT
            fanart = traktit.TRAKTID[trakt]['fanart'] if os.path.exists(path) else CONFIG.ADDON_FANART
            menu = create_addon_data_menu('Trakt', trakt)
            menu2 = create_save_data_menu('Trakt', trakt)
            menu.append((CONFIG.THEME2.format('{0} Settings'.format(name)), 'RunPlugin(plugin://{0}/?mode=opensettings&name={1}&url=trakt)'.format(CONFIG.ADDON_ID, trakt)))

            directory.add_file('[+]-> {0}'.format(name), icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
            if not os.path.exists(path):
                directory.add_file('[COLOR red]Addon Data: Not Installed[/COLOR]', icon=icon, fanart=fanart, menu=menu)
            elif not auser:
                directory.add_file('[COLOR red]Addon Data: Not Registered[/COLOR]', {'mode': 'authtrakt', 'name': trakt}, icon=icon, fanart=fanart, menu=menu)
            else:
                directory.add_file('[COLOR springgreen]Addon Data: {0}[/COLOR]'.format(auser), {'mode': 'authtrakt', 'name': trakt}, icon=icon, fanart=fanart, menu=menu)
            if user == "":
                if os.path.exists(file):
                    directory.add_file('[COLOR red]Saved Data: Save File Found(Import Data)[/COLOR]', {'mode': 'importtrakt', 'name': trakt}, icon=icon, fanart=fanart, menu=menu2)
                else:
                    directory.add_file('[COLOR red]Saved Data: Not Saved[/COLOR]', {'mode': 'savetrakt', 'name': trakt}, icon=icon, fanart=fanart, menu=menu2)
            else:
                directory.add_file('[COLOR springgreen]Saved Data: {0}[/COLOR]'.format(user), icon=icon, fanart=fanart, menu=menu2)

    directory.add_separator()
    directory.add_file('Save All Trakt Data', {'mode': 'savetrakt', 'name': 'all'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_file('Recover All Saved Trakt Data', {'mode': 'restoretrakt', 'name': 'all'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_file('Import Trakt Data', {'mode': 'importtrakt', 'name': 'all'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Addon Trakt Data', {'mode': 'addontrakt', 'name': 'all'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
    directory.add_file('Clear All Saved Trakt Data', {'mode': 'cleartrakt', 'name': 'all'}, icon=CONFIG.ICONTRAKT, themeit=CONFIG.THEME3)
Example #12
0
def system_info():
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs import speedtest

    infoLabel = ['System.FriendlyName', 'System.BuildVersion', 'System.CpuUsage', 'System.ScreenMode',
                 'Network.IPAddress', 'Network.MacAddress', 'System.Uptime', 'System.TotalUptime', 'System.FreeSpace',
                 'System.UsedSpace', 'System.TotalSpace', 'System.Memory(free)', 'System.Memory(used)',
                 'System.Memory(total)']
    data = []
    x = 0
    for info in infoLabel:
        temp = tools.get_info_label(info)
        y = 0
        while temp == "Busy" and y < 10:
            temp = tools.get_info_label(info)
            y += 1
            logging.log("{0} sleep {1}".format(info, str(y)))
            xbmc.sleep(200)
        data.append(temp)
        x += 1
    storage_free = data[8] if 'Una' in data[8] else tools.convert_size(int(float(data[8][:-8])) * 1024 * 1024)
    storage_used = data[9] if 'Una' in data[9] else tools.convert_size(int(float(data[9][:-8])) * 1024 * 1024)
    storage_total = data[10] if 'Una' in data[10] else tools.convert_size(int(float(data[10][:-8])) * 1024 * 1024)
    ram_free = tools.convert_size(int(float(data[11][:-2])) * 1024 * 1024)
    ram_used = tools.convert_size(int(float(data[12][:-2])) * 1024 * 1024)
    ram_total = tools.convert_size(int(float(data[13][:-2])) * 1024 * 1024)

    picture = []
    music = []
    video = []
    programs = []
    repos = []
    scripts = []
    skins = []

    fold = glob.glob(os.path.join(CONFIG.ADDONS, '*/'))
    for folder in sorted(fold, key = lambda x: x):
        foldername = os.path.split(folder[:-1])[1]
        if foldername == 'packages': continue
        xml = os.path.join(folder, 'addon.xml')
        if os.path.exists(xml):
            prov = re.compile("<provides>(.+?)</provides>").findall(tools.read_from_file(xml))
            if len(prov) == 0:
                if foldername.startswith('skin'):
                    skins.append(foldername)
                elif foldername.startswith('repo'):
                    repos.append(foldername)
                else:
                    scripts.append(foldername)
            elif not (prov[0]).find('executable') == -1:
                programs.append(foldername)
            elif not (prov[0]).find('video') == -1:
                video.append(foldername)
            elif not (prov[0]).find('audio') == -1:
                music.append(foldername)
            elif not (prov[0]).find('image') == -1:
                picture.append(foldername)

    directory.add_file('[B]Media Center Info:[/B]', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Name:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[0]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
    directory.add_file('[COLOR {0}]Version:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[1]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
    directory.add_file('[COLOR {0}]Platform:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, tools.platform().title()), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
    directory.add_file('[COLOR {0}]CPU Usage:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[2]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
    directory.add_file('[COLOR {0}]Screen Mode:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[3]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)

    directory.add_file('[B]Uptime:[/B]', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Current Uptime:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[6]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Total Uptime:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, data[7]), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)

    directory.add_file('[B]Local Storage:[/B]', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Used Storage:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, storage_used), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Free Storage:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, storage_free), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Total Storage:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, storage_total), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)

    directory.add_file('[B]Ram Usage:[/B]', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Used Memory:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, ram_free), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Free Memory:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, ram_used), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Total Memory:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, ram_total), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)

    mac, inter_ip, ip, city, state, country, isp = speedtest.net_info()
    directory.add_file('[B]Network:[/B]', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Mac:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, mac), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Internal IP: [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, inter_ip), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]External IP:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, ip), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]City:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, city), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]State:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, state), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Country:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, country), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]ISP:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, isp), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)

    totalcount = len(picture) + len(music) + len(video) + len(programs) + len(scripts) + len(skins) + len(repos)
    directory.add_file('[B]Addons([COLOR {0}]{1}[/COLOR]):[/B]'.format(CONFIG.COLOR1, totalcount), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Video Addons:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(video))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Program Addons:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(programs))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Music Addons:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(music))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Picture Addons:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(picture))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Repositories:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(repos))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Skins:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(skins))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Scripts/Modules:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, str(len(scripts))), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
Example #13
0
def view_ip():
    from resources.libs import speedtest

    mac, inter_ip, ip, city, state, country, isp = speedtest.net_info()
    directory.add_file('[COLOR {0}]MAC:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, mac), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Internal IP: [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, inter_ip), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]External IP:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, ip), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]City:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, city), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]State:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, state), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]Country:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, country), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
    directory.add_file('[COLOR {0}]ISP:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.COLOR2, isp), icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME2)
Example #14
0
 def backup_menu(self):
     directory.add_file('Limpiar carpeta de respaldo',
                        {'mode': 'clearbackup'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file(
         'Ubicación de respaldo: [COLOR {0}]{1}[/COLOR]'.format(
             CONFIG.COLOR2, CONFIG.MYBUILDS), {
                 'mode': 'settings',
                 'name': 'Maintenance'
             },
         icon=CONFIG.ICONMAINT,
         themeit=CONFIG.THEME3)
     directory.add_file('[respaldo]: Build', {
         'mode': 'backup',
         'action': 'build'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[respaldo]: GuiFix', {
         'mode': 'backup',
         'action': 'gui'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[respaldo]: Theme', {
         'mode': 'backup',
         'action': 'theme'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[respaldo]: Addon Pack', {
         'mode': 'backup',
         'action': 'addonpack'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[respaldo]: Addon_data', {
         'mode': 'backup',
         'action': 'addondata'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: Local Build', {
         'mode': 'restore',
         'action': 'build'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: Local GuiFix', {
         'mode': 'restore',
         'action': 'gui'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: Local Theme', {
         'mode': 'restore',
         'action': 'theme'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: Local Addon Pack', {
         'mode': 'restore',
         'action': 'addonpack'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: Local Addon_data', {
         'mode': 'restore',
         'action': 'addondata'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: External Build', {
         'mode': 'restore',
         'action': 'build',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: External GuiFix', {
         'mode': 'restore',
         'action': 'gui',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: External Theme', {
         'mode': 'restore',
         'action': 'theme',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: External Addon Pack', {
         'mode': 'restore',
         'action': 'addonpack',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restaurar]: External Addon_data', {
         'mode': 'restore',
         'action': 'addondata',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
Example #15
0
    def clean_menu(self):
        from resources.libs import clear
        from resources.libs.common import tools

        on = '[B][COLOR deepskyblue]ON[/COLOR][/B]'
        off = '[B][COLOR red]OFF[/COLOR][/B]'

        autoclean = 'true' if CONFIG.AUTOCLEANUP == 'true' else 'false'
        cache = 'true' if CONFIG.AUTOCACHE == 'true' else 'false'
        packages = 'true' if CONFIG.AUTOPACKAGES == 'true' else 'false'
        thumbs = 'true' if CONFIG.AUTOTHUMBS == 'true' else 'false'
        includevid = 'true' if CONFIG.INCLUDEVIDEO == 'true' else 'false'
        includeall = 'true' if CONFIG.INCLUDEALL == 'true' else 'false'

        sizepack = tools.get_size(CONFIG.PACKAGES)
        sizethumb = tools.get_size(CONFIG.THUMBNAILS)
        archive = tools.get_size(CONFIG.ARCHIVE_CACHE)
        sizecache = (clear.get_cache_size()) - archive
        totalsize = sizepack + sizethumb + sizecache

        directory.add_file(
            'Total Clean Up: [COLOR deepskyblue][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(totalsize)), {'mode': 'fullclean'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        directory.add_file(
            'Clear Cache: [COLOR deepskyblue][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(sizecache)), {'mode': 'clearcache'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        if xbmc.getCondVisibility(
                'System.HasAddon(script.module.urlresolver)'
        ) or xbmc.getCondVisibility(
                'System.HasAddon(script.module.resolveurl)'):
            directory.add_file('Clear Resolver Function Caches',
                               {'mode': 'clearfunctioncache'},
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
        directory.add_file(
            'Clear Packages: [COLOR deepskyblue][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(sizepack)), {'mode': 'clearpackages'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        directory.add_file(
            'Clear Thumbnails: [COLOR deepskyblue][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(sizethumb)), {'mode': 'clearthumb'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        if os.path.exists(CONFIG.ARCHIVE_CACHE):
            directory.add_file(
                'Clear Archive_Cache: [COLOR deepskyblue][B]{0}[/B][/COLOR]'.
                format(tools.convert_size(archive)), {'mode': 'cleararchive'},
                icon=CONFIG.ICONMAINT,
                themeit=CONFIG.THEME3)
        directory.add_file('Clear Old Thumbnails', {'mode': 'oldThumbs'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Clear Crash Logs', {'mode': 'clearcrash'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Purge Databases', {'mode': 'purgedb'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Fresh Start', {'mode': 'freshstart'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)

        directory.add_file('Auto Clean',
                           fanart=CONFIG.ADDON_FANART,
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME1)
        directory.add_file('Auto Clean Up On Startup: {0}'.format(
            autoclean.replace('true', on).replace('false', off)), {
                'mode': 'togglesetting',
                'name': 'autoclean'
            },
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        if autoclean == 'true':
            directory.add_file(
                '--- Auto Clean Frequency: [B][COLOR deepskyblue]{0}[/COLOR][/B]'
                .format(CONFIG.CLEANFREQ[CONFIG.AUTOFREQ]),
                {'mode': 'changefreq'},
                icon=CONFIG.ICONMAINT,
                themeit=CONFIG.THEME3)
            directory.add_file('--- Clear Cache on Startup: {0}'.format(
                cache.replace('true', on).replace('false', off)), {
                    'mode': 'togglesetting',
                    'name': 'clearcache'
                },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('--- Clear Packages on Startup: {0}'.format(
                packages.replace('true', on).replace('false', off)), {
                    'mode': 'togglesetting',
                    'name': 'clearpackages'
                },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('--- Clear Old Thumbs on Startup: {0}'.format(
                thumbs.replace('true', on).replace('false', off)), {
                    'mode': 'togglesetting',
                    'name': 'clearthumbs'
                },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
        directory.add_file('Clear Video Cache',
                           fanart=CONFIG.ADDON_FANART,
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME1)
        directory.add_file('Include Video Cache in Clear Cache: {0}'.format(
            includevid.replace('true', on).replace('false', off)), {
                'mode': 'togglecache',
                'name': 'includevideo'
            },
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)

        if includeall == 'true':
            includegaia = 'true'
            includeexodusredux = 'true'
            includethecrew = 'true'
            includeyoda = 'true'
            includevenom = 'true'
            includenumbers = 'true'
            includescrubs = 'true'
            includenewf = 'true'
        else:
            includeexodusredux = 'true' if CONFIG.INCLUDEEXODUSREDUX == 'true' else 'false'
            includegaia = 'true' if CONFIG.INCLUDEGAIA == 'true' else 'false'
            includethecrew = 'true' if CONFIG.INCLUDETHECREW == 'true' else 'false'
            includeyoda = 'true' if CONFIG.INCLUDEYODA == 'true' else 'false'
            includevenom = 'true' if CONFIG.INCLUDEVENOM == 'true' else 'false'
            includenumbers = 'true' if CONFIG.INCLUDENUMBERS == 'true' else 'false'
            includescrubs = 'true' if CONFIG.INCLUDESCRUBS == 'true' else 'false'
            includenewf = 'true' if CONFIG.INCLUDEnewf == 'true' else 'false'

        if includevid == 'true':
            directory.add_file('--- Include All Video Addons: {0}'.format(
                includeall.replace('true', on).replace('false', off)), {
                    'mode': 'togglecache',
                    'name': 'includeall'
                },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility(
                    'System.HasAddon(plugin.video.exodusredux)'):
                directory.add_file('--- Include Exodus Redux: {0}'.format(
                    includeexodusredux.replace('true',
                                               on).replace('false', off)), {
                                                   'mode': 'togglecache',
                                                   'name': 'includeexodusredux'
                                               },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility('System.HasAddon(plugin.video.gaia)'):
                directory.add_file('--- Include Gaia: {0}'.format(
                    includegaia.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includegaia'
                    },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility(
                    'System.HasAddon(plugin.video.numbersbynumbers)'):
                directory.add_file('--- Include NuMb3r5: {0}'.format(
                    includenumbers.replace('true', on).replace('false', off)),
                                   {
                                       'mode': 'togglecache',
                                       'name': 'includenumbers'
                                   },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility(
                    'System.HasAddon(plugin.video.scrubsv2)'):
                directory.add_file('--- Include Scrubs v2: {0}'.format(
                    includescrubs.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includescrubs'
                    },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility('System.HasAddon(plugin.video.newf)'):
                directory.add_file('--- Include newf: {0}'.format(
                    includenewf.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includenewf'
                    },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility('System.HasAddon(plugin.video.thecrew)'):
                directory.add_file('--- Include THE CREW: {0}'.format(
                    includethecrew.replace('true', on).replace('false', off)),
                                   {
                                       'mode': 'togglecache',
                                       'name': 'includethecrew'
                                   },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility('System.HasAddon(plugin.video.venom)'):
                directory.add_file('--- Include Venom: {0}'.format(
                    includevenom.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includevenom'
                    },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            if xbmc.getCondVisibility('System.HasAddon(plugin.video.yoda)'):
                directory.add_file('--- Include Yoda: {0}'.format(
                    includeyoda.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includeyoda'
                    },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
            directory.add_file('--- Enable All Video Addons', {
                'mode': 'togglecache',
                'name': 'true'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('--- Disable All Video Addons', {
                'mode': 'togglecache',
                'name': 'false'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
Example #16
0
def remove_addon_data_menu():
    if os.path.exists(CONFIG.ADDON_DATA):
        directory.add_file('[COLOR red][B][REMOVE][/B][/COLOR] All Addon_Data', {'mode': 'removedata', 'name': 'all'}, themeit=CONFIG.THEME2)
        directory.add_file('[COLOR red][B][REMOVE][/B][/COLOR] All Addon_Data for Uninstalled Addons', {'mode': 'removedata', 'name': 'uninstalled'}, themeit=CONFIG.THEME2)
        directory.add_file('[COLOR red][B][REMOVE][/B][/COLOR] All Empty Folders in Addon_Data', {'mode': 'removedata', 'name': 'empty'}, themeit=CONFIG.THEME2)
        directory.add_file('[COLOR red][B][REMOVE][/B][/COLOR] {0} Addon_Data'.format(CONFIG.ADDONTITLE), {'mode': 'resetaddon'}, themeit=CONFIG.THEME2)
        directory.add_separator(themeit=CONFIG.THEME3)
        fold = glob.glob(os.path.join(CONFIG.ADDON_DATA, '*/'))
        for folder in sorted(fold, key = lambda x: x):
            foldername = folder.replace(CONFIG.ADDON_DATA, '').replace('\\', '').replace('/', '')
            icon = os.path.join(folder.replace(CONFIG.ADDON_DATA, CONFIG.ADDONS), 'icon.png')
            fanart = os.path.join(folder.replace(CONFIG.ADDON_DATA, CONFIG.ADDONS), 'fanart.png')
            folderdisplay = foldername
            replace = {'audio.': '[COLOR orange][AUDIO] [/COLOR]', 'metadata.': '[COLOR cyan][METADATA] [/COLOR]',
                       'module.': '[COLOR orange][MODULE] [/COLOR]', 'plugin.': '[COLOR blue][PLUGIN] [/COLOR]',
                       'program.': '[COLOR orange][PROGRAM] [/COLOR]', 'repository.': '[COLOR gold][REPO] [/COLOR]',
                       'script.': '[COLOR springgreen][SCRIPT] [/COLOR]',
                       'service.': '[COLOR springgreen][SERVICE] [/COLOR]', 'skin.': '[COLOR dodgerblue][SKIN] [/COLOR]',
                       'video.': '[COLOR orange][VIDEO] [/COLOR]', 'weather.': '[COLOR yellow][WEATHER] [/COLOR]'}
            for rep in replace:
                folderdisplay = folderdisplay.replace(rep, replace[rep])
            if foldername in CONFIG.EXCLUDES:
                folderdisplay = '[COLOR springgreen][B][PROTECTED][/B][/COLOR] {0}'.format(folderdisplay)
            else:
                folderdisplay = '[COLOR red][B][REMOVE][/B][/COLOR] {0}'.format(folderdisplay)
            directory.add_file(' {0}'.format(folderdisplay), {'mode': 'removedata', 'name': foldername}, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
    else:
        directory.add_file('No Addon data folder found.', themeit=CONFIG.THEME3)
    def show_menu(self, url=None):
        response = tools.open_url(CONFIG.ADDONFILE)
        url_response = tools.open_url(url)
        local_file = os.path.join(CONFIG.ADDON_PATH, 'resources', 'text',
                                  'addons.json')

        if url_response:
            TEMPADDONFILE = url_response.text
        elif response:
            TEMPADDONFILE = response.text
        elif os.path.exists(local_file):
            TEMPADDONFILE = tools.read_from_file(local_file)
        else:
            TEMPADDONFILE = None
            logging.log("[Addon Menu] No Addon list added.")

        if TEMPADDONFILE:
            import json

            try:
                addons_json = json.loads(TEMPADDONFILE)
            except:
                addons_json = None
                logging.log(
                    "[Advanced Settings] ERROR: Invalid Format for {0}.".
                    format(TEMPADDONFILE))

            if addons_json:
                addons = addons_json['addons']

                if addons and len(addons) > 0:
                    for addon in addons:
                        addonname = addon.get('name', '')
                        type = addon.get('type', 'addon')
                        section = addon.get('section', False)
                        plugin = addon.get('plugin', '')
                        addonurl = addon.get('url', '')
                        repository = addon.get('repository', '')
                        repositoryxml = addon.get('repositoryxml', '')
                        repositoryurl = addon.get('repositoryurl', '')
                        icon = addon.get('icon', CONFIG.ADDON_ICON)
                        fanart = addon.get('fanart', CONFIG.ADDON_FANART)
                        adult = addon.get('adult', False)
                        description = addon.get('description', '')

                        if not addonname:
                            logging.log(
                                '[Advanced Settings] Missing tag \'name\'',
                                level=xbmc.LOGDEBUG)
                            continue

                        if not addonurl:
                            logging.log(
                                '[Advanced Settings] Missing tag \'url\'',
                                level=xbmc.LOGDEBUG)
                            continue
                        else:
                            if '.zip' in addonurl:
                                pass
                            elif not section:
                                broken = False
                                if not repository:
                                    logging.log(
                                        '[Advanced Settings] Missing tag \'repository\'',
                                        level=xbmc.LOGDEBUG)
                                    broken = True
                                if not repositoryxml:
                                    logging.log(
                                        '[Advanced Settings] Missing tag \'repositoryxml\'',
                                        level=xbmc.LOGDEBUG)
                                    broken = True
                                if not repositoryurl:
                                    logging.log(
                                        '[Advanced Settings] Missing tag \'repositoryurl\'',
                                        level=xbmc.LOGDEBUG)
                                    broken = True
                                if broken:
                                    continue

                        if section:
                            directory.add_dir(addonname, {
                                'mode': 'addons',
                                'url': addonurl
                            },
                                              description=description,
                                              icon=icon,
                                              fanart=fanart,
                                              themeit=CONFIG.THEME3)
                        else:
                            if not CONFIG.SHOWADULT == 'true' and adult:
                                continue

                            if type.lower() == 'skin':
                                directory.add_file(addonname, {
                                    'mode': 'addons',
                                    'action': 'skin',
                                    'name': addonname,
                                    'url': addonurl
                                },
                                                   description=description,
                                                   icon=icon,
                                                   fanart=fanart,
                                                   themeit=CONFIG.THEME2)
                            elif type.lower() == 'addonpack':
                                directory.add_file(addonname, {
                                    'mode': 'addons',
                                    'action': 'addonpack',
                                    'name': addonname,
                                    'url': addonurl
                                },
                                                   description=description,
                                                   icon=icon,
                                                   fanart=fanart,
                                                   themeit=CONFIG.THEME2)
                            else:
                                try:
                                    add = tools.get_addon_info(plugin, 'path')
                                    if os.path.exists(add):
                                        addonname = "[COLOR springgreen][Installed][/COLOR] {0}".format(
                                            addonname)
                                except:
                                    pass

                                directory.add_file(
                                    addonname, {
                                        'mode': 'addons',
                                        'action': 'addon',
                                        'name': plugin,
                                        'addonurl': addonurl,
                                        'repository': repository,
                                        'repositoryxml': repositoryxml,
                                        'repositoryurl': repositoryurl
                                    },
                                    description=description,
                                    icon=icon,
                                    fanart=fanart,
                                    themeit=CONFIG.THEME2)
                else:
                    if not addons:
                        directory.add_file(
                            'Text File not formatted correctly!',
                            themeit=CONFIG.THEME3)
                        logging.log("[Addon Menu] ERROR: Invalid Format.")
                    elif len(addons) == 0:
                        directory.add_file("No addons added to this menu yet!",
                                           themeit=CONFIG.THEME2)
        else:
            logging.log("[Addon Menu] ERROR: URL for Addon list not working.")
            directory.add_file('Url for txt file not valid',
                               themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.ADDONFILE),
                               themeit=CONFIG.THEME3)
Example #18
0
def developer():
    directory.add_file('Create QR Code', {'mode': 'createqr'}, themeit=CONFIG.THEME1)
    directory.add_file('Test Notifications', {'mode': 'testnotify'}, themeit=CONFIG.THEME1)
    directory.add_file('Test Update', {'mode': 'testupdate'}, themeit=CONFIG.THEME1)
    directory.add_file('Test Build Prompt', {'mode': 'testbuildprompt'}, themeit=CONFIG.THEME1)
    directory.add_file('Test Save Data Settings', {'mode': 'testsavedata'}, themeit=CONFIG.THEME1)
    directory.add_file('Test Binary Detection', {'mode': 'binarycheck'}, themeit=CONFIG.THEME1)
    def get_listing(self):
        from resources.libs import test
        
        response = tools.open_url(CONFIG.BUILDFILE)
        
        if response:
            link = tools.clean_text(response.text)
        else:
            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(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)
Example #20
0
    def get_listing(self):
        from resources.libs import test

        response = tools.open_url(CONFIG.BUILDFILE)

        if response:
            link = tools.clean_text(response.text)
        else:
            directory.add_file('Bạn đang dùng Kodi: {0} {1}'.format(
                CONFIG.KODIV,
                tools.platform().title()),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_separator()
            directory.add_file('Hiện tại không có bản Build nào để sử dụng',
                               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(link)
        match = re.compile(
            'name="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?escription="(.+?)"'
        ).findall(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
        if not CONFIG.get_setting('buildlink') == '':
            directory.add_file('Custom Build URL: [COLOR yellow]%s[/COLOR]' %
                               (CONFIG.BUILDFILE), {'mode': ''},
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_file(
                '[COLOR yellow][B]Reset:[/B][/COLOR] Xóa link trả về mặc định',
                {'mode': 'clearurl'},
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)
            directory.add_file('Bạn đang dùng Kodi: {0} {1}'.format(
                CONFIG.KODIV,
                tools.platform().title()),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_file(
                '===== [COLOR red][B]CHỌN BẢN CUSTOM BUILD MUỐN SỬ DỤNG[/B][/COLOR] =====',
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)
            self._list_build(match)
        else:
            directory.add_dir(
                '[COLOR yellow][B]Custom Build URL:[/B][/COLOR] Nhập list của bạn',
                {
                    'mode': 'inputurl',
                    'name': 'buildlink'
                },
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)
            directory.add_file('Bạn đang dùng Kodi: {0} {1}'.format(
                CONFIG.KODIV,
                tools.platform().title()),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            # directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3)
            directory.add_file(
                '===== [COLOR red][B]CHỌN BẢN BUILD MUỐN SỬ DỤNG[/B][/COLOR] =====',
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)
            # directory.add_separator()
            self._list_build(match)
 def backup_menu(self):
     directory.add_file('Clean Up Back Up Folder', {'mode': 'clearbackup'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('Back Up Location: [COLOR {0}]{1}[/COLOR]'.format(
         CONFIG.COLOR2, CONFIG.MYBUILDS), {
             'mode': 'settings',
             'name': 'Maintenance'
         },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Build', {
         'mode': 'backup',
         'action': 'build'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: GuiFix', {
         'mode': 'backup',
         'action': 'gui'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Theme', {
         'mode': 'backup',
         'action': 'theme'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Addon Pack', {
         'mode': 'backup',
         'action': 'addonpack'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Addon_data', {
         'mode': 'backup',
         'action': 'addondata'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Build', {
         'mode': 'restore',
         'action': 'build'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local GuiFix', {
         'mode': 'restore',
         'action': 'gui'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Theme', {
         'mode': 'restore',
         'action': 'theme'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Addon Pack', {
         'mode': 'restore',
         'action': 'addonpack'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Addon_data', {
         'mode': 'restore',
         'action': 'addondata'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Build', {
         'mode': 'restore',
         'action': 'build',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External GuiFix', {
         'mode': 'restore',
         'action': 'gui',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Theme', {
         'mode': 'restore',
         'action': 'theme',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Addon Pack', {
         'mode': 'restore',
         'action': 'addonpack',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Addon_data', {
         'mode': 'restore',
         'action': 'addondata',
         'name': 'external'
     },
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
Example #22
0
    def logging_menu(self):
        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('Toggle Registro de depuración',
                           {'mode': 'enabledebug'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Cargar archivo de registro', {'mode': 'uploadlog'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file(
            'Ver errores en el registro: [COLOR springgreen][B]{0}[/B][/COLOR]'
            .format(errorsfound), {'mode': 'viewerrorlog'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        if errors > 0:
            directory.add_file('Ver el último error en el registro',
                               {'mode': 'viewerrorlast'},
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
        directory.add_file('Ver archivo de registro', {'mode': 'viewlog'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Ver archivo de registro del asistente',
                           {'mode': 'viewwizlog'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file(
            'Borrar archivo de registro del asistente: [COLOR springgreen][B]{0}[/B][/COLOR]'
            .format(wizlogsize), {'mode': 'clearwizlog'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)