Exemple #1
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 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, 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)

        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)
Exemple #3
0
 def quick_configure(self):
     directory.add_file('Mudanças não serão refletidas até que o Kodi seja reiniciado.', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_file('Clique aqui para reiniciar o Kodi.', {'mode': 'forceclose'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_file('Mais categorias em breve :)', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_separator(middle='CATEGORIES')
     # directory.add_dir('Troubleshooting', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'loglevel|jsonrpc'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Playback', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'skiploopfilter|video|audio|edl|pvr|epg|forcedswaptime'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Video Library', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'videoextensions|discstubextensions|languagecodes|moviestacking|folderstacking|cleandatetime|cleanstrings|tvshowmatching|tvmultipartmatching'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_dir('Rede e Cache', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'cache|network'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
Exemple #4
0
    def show_menu(self, url=None):
        infoLabel = [
            '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
        # ram_used = tools.convert_size(int(float(data[1][:-2])) * 1024 * 1024)
        ram_free = tools.convert_size(int(float(data[0][:-2])) * 1024 * 1024)
        # ram_total = tools.convert_size(int(float(data[2][:-2])) * 1024 * 1024)
        directory.add_file(
            '[COLOR {0}]Ram còn trống:[/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
                CONFIG.COLOR1, CONFIG.COLOR2, ram_free),
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME2)
        directory.add_dir('Thay đổi thông số file Advancedsettings.xml', {
            'mode': 'advanced_settings',
            'action': 'show_section',
            'tags': 'cache|network'
        },
                          icon=CONFIG.ICONMAINT,
                          themeit=CONFIG.THEME3)

        if os.path.exists(CONFIG.ADVANCED):
            directory.add_file('Xem file Advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'view_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('Xóa file Advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'remove_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
        directory.add_separator(icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        directory.add_file(
            '[COLOR yellow][B]Auto Set:[/B][/COLOR] Thiết lập Memcache theo dung lượng Ram',
            {
                'mode': 'advanced_settings',
                'action': 'auto_memcache'
            },
            description=
            'Thiết lập thông số Memcache dựa vào dung lượng Ram trống trên thiết bị.',
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
Exemple #5
0
def speed_test():
    from datetime import date

    directory.add_file('Run Speed Test', {'mode': 'runspeedtest'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
    if os.path.exists(CONFIG.SPEEDTEST):
        speedimg = glob.glob(os.path.join(CONFIG.SPEEDTEST, '*.png'))
        speedimg.sort(key=lambda f: os.path.getmtime(f), reverse=True)
        if len(speedimg) > 0:
            directory.add_file('Clear Results', {'mode': 'clearspeedtest'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
            directory.add_separator('Previous Runs', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
            for item in speedimg:
                created = date.fromtimestamp(os.path.getmtime(item)).strftime('%m/%d/%Y %H:%M:%S')
                img = item.replace(os.path.join(CONFIG.SPEEDTEST, ''), '')
                directory.add_file('[B]{0}[/B]: [I]Ran {1}[/I]'.format(img, created), {'mode': 'viewspeedtest', 'name': img}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
Exemple #6
0
    def show_section(self, tags):
        from xml.etree import ElementTree

        split_tags = tags.split('|')
        logging.log(split_tags)

        exists = os.path.exists(CONFIG.ADVANCED)

        if exists:
            root = ElementTree.parse(CONFIG.ADVANCED).getroot()

            for category in root.findall('*'):
                name = category.tag
                if name not in split_tags:
                    continue

                values = {}

                for element in category.findall('*'):
                    values[element.tag] = element.text

                self.tags[name] = values

        if len(self.tags) == 0:
            directory.add_file(
                'No existe ninguna configuración para esta categoría en su advancedsettings.xml file.',
                icon=CONFIG.ICONMAINT,
                themeit=CONFIG.THEME3)
            directory.add_separator()

        for category in self.tags:
            directory.add_separator(category.upper())

            for tag in self.tags[category]:
                value = self.tags[category][tag]

                if value is None:
                    value = ''

                directory.add_file('{0}: {1}'.format(tag, value), {
                    'mode': 'advanced_settings',
                    'action': 'set_setting',
                    'category': category,
                    'tag': tag,
                    'value': value
                },
                                   icon=CONFIG.ICONMAINT,
                                   themeit=CONFIG.THEME3)
Exemple #7
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)
Exemple #8
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)
Exemple #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)
Exemple #10
0
 def backuprestore_menu(self):
     backuppath = CONFIG.get_setting('path')
     dialog = xbmcgui.Dialog()
     if backuppath=='':
         if dialog.ok(CONFIG.ADDONTITLE,'Bạn chưa thiết lập đường dẫn lưu file Backup cho Kodi \n Mở Addon Setting và Chọn tab [COLOR green][B]Zip Folder[/B][/COLOR].\n Nhấn [B]OK[/B] để bắt đầu thiết lập'):
             backupdir = dialog.browse(0, '[COLOR yellow]Chọn đường dẫn lưu file Backup[/COLOR]', '', '', False, False)
             CONFIG.set_setting('path', backupdir)
             xbmc.executebuiltin('Container.Refresh()')
             self.backuprestore_menu()
         else: MainMenu().get_listing()
         # xbmc.executebuiltin('Container.Refresh()')
     else:
        directory.add_file('[COLOR {0}][B]Backup Location:[/B][/COLOR] {1}'.format(CONFIG.COLOR1, backuppath), {'mode': 'settings', 'name': 'Maintenance'}, icon=CONFIG.ICONDIR, themeit=CONFIG.THEME3)
        directory.add_file('[COLOR {0}][B]Clean Backup:[/B][/COLOR] Dọn dẹp thư mục Backup'.format(CONFIG.COLOR1), {'mode': 'clearbackup'}, icon=CONFIG.ICONDELPACK, themeit=CONFIG.THEME3)
        directory.add_file('[COLOR red][B]Refresh KODI[/B][/COLOR] - Khôi phục Kodi về mặc định (giữ nguyên Repository)', {'mode': 'freshstart'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        directory.add_separator()
        directory.add_dir('[COLOR green][B]BACKUP:[/B][/COLOR] Sao lưu Kodi', {'mode': 'maint', 'name': 'backup'}, icon=CONFIG.ICONBACKUP, themeit=CONFIG.THEME1)
        directory.add_dir('[COLOR yellow][B]RESTORE:[/B][/COLOR] Khôi phục Kodi', {'mode': 'maint', 'name': 'restore'}, icon=CONFIG.ICONRESTORE, themeit=CONFIG.THEME1)
Exemple #11
0
 def quick_configure(self):
     directory.add_file(
         'Changes will not be reflected until Kodi is restarted.',
         icon=CONFIG.ICONMAINT,
         themeit=CONFIG.THEME3)
     directory.add_file('Click here to restart Kodi.',
                        {'mode': 'forceclose'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('More categories coming soon :)',
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_separator(middle='CATEGORIES')
     directory.add_dir('Network and Cache', {
         'mode': 'advanced_settings',
         'action': 'show_section',
         'tags': 'cache|network'
     },
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
Exemple #12
0
 def quick_configure(self):
     directory.add_file(
         '[COLOR azure]Los cambios no se reflejarán hasta que se reinicie Kodi.[/COLOR]',
         icon=CONFIG.ICONMAINT,
         themeit=CONFIG.THEME3)
     directory.add_file(
         '[COLOR azure]Haga Clic aquí para reiniciar Kodi.[/COLOR]',
         {'mode': 'forceclose'},
         icon=CONFIG.ICONMAINT,
         themeit=CONFIG.THEME3)
     # directory.add_file('Más categorías próximamente :)', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_separator(middle='[B]CATEGORIAS[/B]')
     # directory.add_dir('Troubleshooting', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'loglevel|jsonrpc'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Playback', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'skiploopfilter|video|audio|edl|pvr|epg|forcedswaptime'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Video Library', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'videoextensions|discstubextensions|languagecodes|moviestacking|folderstacking|cleandatetime|cleanstrings|tvshowmatching|tvmultipartmatching'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_dir('[COLOR azure]RED y CACHE[/COLOR]', {
         'mode': 'advanced_settings',
         'action': 'show_section',
         'tags': 'cache|network'
     },
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
Exemple #13
0
def apk_menu(url=None):
    from resources.libs.common import logging
    from resources.libs.common import tools

    if not url:
        directory.add_dir('Official Kodi APK\'s', {'mode': 'apkscrape', 'name': 'kodi'}, icon=CONFIG.ICONAPK, themeit=CONFIG.THEME1)
        directory.add_separator()

    response = tools.open_url(CONFIG.APKFILE)
    url_response = tools.open_url(url)

    if response:
        TEMPAPKFILE = url_response.text if url else response.text

        if TEMPAPKFILE:
            match = re.compile('name="(.+?)".+?ection="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"').findall(TEMPAPKFILE)
            if len(match) > 0:
                x = 0
                for aname, section, url, icon, fanart, adult, description in match:
                    if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                        continue
                    if section.lower() == 'yes':
                        x += 1
                        directory.add_dir("[B]{0}[/B]".format(aname), {'mode': 'apk', 'name': aname, 'url': url}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
                    else:
                        x += 1
                        directory.add_file(aname, {'mode': 'apkinstall', 'name': aname, 'url': url}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
                    if x == 0:
                        directory.add_file("No addons added to this menu yet!", themeit=CONFIG.THEME2)
            else:
                logging.log("[APK Menu] ERROR: Invalid Format.", level=xbmc.LOGERROR)
        else:
            logging.log("[APK Menu] ERROR: URL for apk list not working.", level=xbmc.LOGERROR)
            directory.add_file('Url for txt file not valid', themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.APKFILE), themeit=CONFIG.THEME3)
        return
    else:
        logging.log("[APK Menu] No APK list added.")
Exemple #14
0
 def quick_configure(self):
     directory.add_file(
         'Changes will not be reflected until Kodi is restarted.',
         icon=CONFIG.ICONMAINT,
         themeit=CONFIG.THEME3)
     directory.add_file('Click here to restart Kodi.',
                        {'mode': 'forceclose'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('More categories coming soon :)',
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_separator(middle='CATEGORIES')
     # directory.add_dir('Troubleshooting', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'loglevel|jsonrpc'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Playback', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'skiploopfilter|video|audio|edl|pvr|epg|forcedswaptime'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     # directory.add_dir('Video Library', {'mode': 'advanced_settings', 'action': 'show_section', 'tags': 'videoextensions|discstubextensions|languagecodes|moviestacking|folderstacking|cleandatetime|cleanstrings|tvshowmatching|tvmultipartmatching'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_dir('Network and Cache', {
         'mode': 'advanced_settings',
         'action': 'show_section',
         'tags': 'cache|network'
     },
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
Exemple #15
0
    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(es) Encontrado' if errors > 0 else 'Nada Encontrado'

        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][ACTUALIZACIÓN 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 = '[B]{0} - v{1}[/B]'.format(CONFIG.BUILDNAME, CONFIG.BUILDVERSION)
            if version > CONFIG.BUILDVERSION:
                build = '{0} [COLOR red][B][ACTUALIZACIÓN 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('Nada' if CONFIG.BUILDTHEME == "" else CONFIG.BUILDTHEME, {'mode': 'theme', 'name': CONFIG.BUILDNAME},
                                   themeit=CONFIG.THEME5)
        else:
            directory.add_dir('Nada', {'mode': 'builds'}, themeit=CONFIG.THEME4)
        directory.add_separator()
        directory.add_dir('[B][COLOR dodgerblue]BUILDS[/COLOR] - [COLOR dodgerblue]PARCHES[/COLOR][/B]', {'mode': 'builds'}, icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME1)
        directory.add_dir('[B]Mantenimiento[/B]', {'mode': 'maint'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1)
        if (tools.platform() == 'android' or CONFIG.DEVELOPER == 'true'):
            directory.add_dir('Instalador de APK', {'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('Instalador de Addon', {'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('[B]Guardar Datos[/B]', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME1)
        if CONFIG.HIDECONTACT == 'No':
            directory.add_file('Contacto', {'mode': 'contact'}, icon=CONFIG.ICONCONTACT, themeit=CONFIG.THEME1)
        directory.add_separator()
        directory.add_file('Cargar Archivo de Registro', {'mode': 'uploadlog'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1)
        directory.add_file('[B]Ver Errores en el Registro:[/B] [COLOR teal]{0}[/COLOR]'.format(errorsfound), {'mode': 'viewerrorlog'}, icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME1)
        if errors > 0:
            directory.add_file('Ver el Ultimo Error en el Registro', {'mode': 'viewerrorlast'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1)
        directory.add_separator()
        directory.add_file('[B]Ajustes[/B]', {'mode': 'settings', 'name': CONFIG.ADDON_ID}, icon=CONFIG.ICONSETTINGS, themeit=CONFIG.THEME1)
        if CONFIG.DEVELOPER == 'true':
            directory.add_dir('Menú de Desarrollador', {'mode': 'developer'}, icon=CONFIG.ADDON_ICON, themeit=CONFIG.THEME1)
Exemple #16
0
    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('Fresh Install', {
                'mode': 'install',
                'action': 'fresh',
                'name': name
            },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME1)
            directory.add_file('Standard Install', {
                'mode': 'install',
                'action': 'normal',
                '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)
Exemple #17
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)
Exemple #18
0
    def show_menu(self, url=None):
        directory.add_dir(
            '[COLOR azure]Configuración Rápida advancedsettings.xml[/COLOR]', {
                'mode': 'advanced_settings',
                'action': 'quick_configure'
            },
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)

        if os.path.exists(CONFIG.ADVANCED):
            directory.add_file('Ver Actual advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'view_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('Eliminar Actual advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'remove_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)

        response = tools.open_url(CONFIG.ADVANCEDFILE)
        url_response = tools.open_url(url)
        local_file = os.path.join(CONFIG.ADDON_PATH, 'resources', 'text',
                                  'advanced.json')

        if url_response:
            TEMPADVANCEDFILE = url_response.text
        elif response:
            TEMPADVANCEDFILE = response.text
        elif os.path.exists(local_file):
            TEMPADVANCEDFILE = tools.read_from_file(local_file)
        else:
            TEMPADVANCEDFILE = None
            logging.log(
                "[Advanced Settings] No hay Ajustes Preestablecidos Disponibles"
            )

        if TEMPADVANCEDFILE:
            import json

            directory.add_separator(icon=CONFIG.ICONMAINT,
                                    themeit=CONFIG.THEME3)

            try:
                advanced_json = json.loads(TEMPADVANCEDFILE)
            except:
                advanced_json = None
                logging.log(
                    "[Advanced Settings] ERROR: Formato no válido para {0}.".
                    format(TEMPADVANCEDFILE))

            if advanced_json:
                presets = advanced_json['presets']
                if presets and len(presets) > 0:
                    for preset in presets:
                        name = preset.get('name', '')
                        section = preset.get('section', False)
                        preseturl = preset.get('url', '')
                        icon = preset.get('icon', CONFIG.ADDON_ICON)
                        fanart = preset.get('fanart', CONFIG.ADDON_FANART)
                        description = preset.get('description', '')

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

                        if section:
                            directory.add_dir(name, {
                                'mode': 'advanced_settings',
                                'url': preseturl
                            },
                                              description=description,
                                              icon=icon,
                                              fanart=fanart,
                                              themeit=CONFIG.THEME3)
                        else:
                            directory.add_file(name, {
                                'mode': 'advanced_settings',
                                'action': 'write_advanced',
                                'name': name,
                                'url': preseturl
                            },
                                               description=description,
                                               icon=icon,
                                               fanart=fanart,
                                               themeit=CONFIG.THEME2)
        else:
            logging.log("[Advanced Settings] URL no funciona: {0}".format(
                CONFIG.ADVANCEDFILE))
Exemple #19
0
    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)
Exemple #20
0
 def view_build(self, name):
     if 19 - 19: I11i + Oo0ooO0oo0oO
     iiiI11 = tools.open_url(CONFIG.BUILDFILE)
     if 53 - 53: OoooooooOO.i1IIi
     if iiiI11:
         oOoOo00oOo = tools.clean_text(iiiI11.text)
     else:
         directory.add_file('URL para arquivo txt não é válido',
                            themeit=CONFIG.THEME3)
         directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                            themeit=CONFIG.THEME3)
         return
         if 18 - 18: o0oOOo0O0Ooo
     if not check.check_build(name, 'version'):
         directory.add_file('Erro ao ler o arquivo txt.',
                            themeit=CONFIG.THEME3)
         directory.add_file(
             '{0} não foi encontrado na lista de builds.'.format(name),
             themeit=CONFIG.THEME3)
         return
         if 28 - 28:
             OOooOOo - O00oOoOoO0o0O.O00oOoOoO0o0O + OoOoOO00 - OoooooooOO + O0
     Oo = re.compile(
         'name="%s".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?review="(.+?)".+?dult="(.+?)".+?nfo="(.+?)".+?escription="(.+?)"'
         % name).findall(oOoOo00oOo)
     if 95 - 95: OoO0O00 % oO0o.O0
     for o00, Oo0oO0ooo, o0oOoO00o, i1, oOOOo0o0O, i1111, i11, I1i1I, I11, oOO00oOO, Oo0o0000o0o0 in Oo:
         OoOo = '{0} (v{1})'.format(name, o00)
         if 18 - 18: i11iIiiIii
         Ii11I = CONFIG.BUILDNAME == name and o00 > CONFIG.BUILDVERSION
         OOO0OOO00oo = True if float(CONFIG.KODIV) == float(i1) else False
         Iii111II = tools.open_url(I1i1I, check=True)
         iiii11I = tools.open_url(o0oOoO00o, check=True)
         Ooo0OO0oOO = tools.open_url(oOOOo0o0O, check=True)
         if 50 - 50: I1IiiI
         if Ii11I:
             OoOo = '{0} [COLOR red][CURRENT v{1}][/COLOR]'.format(
                 OoOo, CONFIG.BUILDVERSION)
             if 34 - 34: I1IiiI * II111iiii % iii1I1I * OoOoOO00 - I1IiiI
         directory.add_file(OoOo,
                            description=Oo0o0000o0o0,
                            fanart=i11,
                            icon=i1111,
                            themeit=CONFIG.THEME4)
         directory.add_separator()
         directory.add_dir('Menu Salvar Dados', {'mode': 'savedata'},
                           icon=CONFIG.ICONSAVE,
                           themeit=CONFIG.THEME3)
         directory.add_file('Informações de construção', {
             'mode': 'buildinfo',
             'name': name
         },
                            description=Oo0o0000o0o0,
                            fanart=i11,
                            icon=i1111,
                            themeit=CONFIG.THEME3)
         if 33 - 33: o0oOOo0O0Ooo + OOooOOo * OoO0O00 - Oo0Ooo / oO0o % Ii1I
         if Iii111II:
             directory.add_file('Ver visualização do vídeo', {
                 'mode': 'buildpreview',
                 'name': name
             },
                                description=Oo0o0000o0o0,
                                fanart=i11,
                                icon=i1111,
                                themeit=CONFIG.THEME3)
             if 21 - 21: OoO0O00 * iIii1I11I1II1 % oO0o * i1IIi
         if OOO0OOO00oo:
             directory.add_file(
                 '[I]Construir projetado para Kodi v{0} (instalado: v{1})[/I]'
                 .format(str(i1), str(CONFIG.KODIV)),
                 fanart=i11,
                 icon=i1111,
                 themeit=CONFIG.THEME3)
             if 16 - 16: O0 - O0oo0OO0 * iIii1I11I1II1 + iii1I1I
         directory.add_separator('INSTALAR')
         directory.add_file('INSTALAR', {
             'mode': 'install',
             'action': 'build',
             'name': name
         },
                            description=Oo0o0000o0o0,
                            fanart=i11,
                            icon=i1111,
                            themeit=CONFIG.THEME1)
         if 50 - 50:
             II111iiii - Oo0ooO0oo0oO * I1ii11iIi11i / O0oo0OO0 + o0oOOo0O0Ooo
         if iiii11I:
             directory.add_file('Aplicar guiFix', {
                 'mode': 'install',
                 'action': 'gui',
                 'name': name
             },
                                description=Oo0o0000o0o0,
                                fanart=i11,
                                icon=i1111,
                                themeit=CONFIG.THEME1)
             if 88 - 88:
                 Ii1I / O0oo0OO0 + iii1I1I - II111iiii / Oo0ooO0oo0oO - OoOoOO00
         if Ooo0OO0oOO:
             directory.add_separator('TEMAS', fanart=i11, icon=i1111)
             if 15 - 15: I1ii11iIi11i + OoOoOO00 - OoooooooOO / OOooOOo
             iiiI11 = tools.open_url(oOOOo0o0O)
             oOOoo00O0O = iiiI11.text
             oo000OO00Oo = tools.clean_text(oOOoo00O0O)
             Oo = re.compile(
                 'name="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"'
             ).findall(oo000OO00Oo)
             for O0OOO0OOoO0O, O00Oo000ooO0, OoO0O00IIiII, o0, ooOooo000oOO, Oo0o0000o0o0 in Oo:
                 Oo0oOOo = CONFIG.SHOWADULT != 'true' and ooOooo000oOO.lower(
                 ) == 'yes'
                 if 58 - 58: II111iiii * OOooOOo * I1ii11iIi11i / OOooOOo
                 if Oo0oOOo:
                     continue
                     if 75 - 75: oO0o
                 I1III = O0OOO0OOoO0O if not O0OOO0OOoO0O == CONFIG.BUILDTHEME else "[B]{0} (Installed)[/B]".format(
                     O0OOO0OOoO0O)
                 OoO0O00IIiII = OoO0O00IIiII if tools.open_url(
                     OoO0O00IIiII, check=True) else i1111
                 o0 = o0 if tools.open_url(o0, check=True) else i11
                 if 63 - 63: OOooOOo % oO0o * oO0o * OoO0O00 / I1ii11iIi11i
                 directory.add_file(I1III, {
                     'mode': 'install',
                     'action': 'theme',
                     'name': name,
                     'url': O0OOO0OOoO0O
                 },
                                    description=Oo0o0000o0o0,
                                    fanart=o0,
                                    icon=OoO0O00IIiII,
                                    themeit=CONFIG.THEME3)
                 if 74 - 74: II111iiii
Exemple #21
0
 def get_listing(self):
     from resources.libs import test
     if 42 - 42: oO0o - i1IIi / i11iIiiIii + OOooOOo + OoO0O00
     iiiI11 = tools.open_url(CONFIG.BUILDFILE)
     if 17 - 17: oO0o.Oo0Ooo.I1ii11iIi11i
     if iiiI11:
         oOoOo00oOo = tools.clean_text(iiiI11.text)
     else:
         directory.add_file('Versão Kodi: {0}'.format(CONFIG.KODIV),
                            icon=CONFIG.ICONBUILDS,
                            themeit=CONFIG.THEME3)
         directory.add_dir('Menu Salvar Dados', {'mode': 'savedata'},
                           icon=CONFIG.ICONSAVE,
                           themeit=CONFIG.THEME3)
         directory.add_separator()
         directory.add_file('URL para arquivo txt não é válido',
                            icon=CONFIG.ICONBUILDS,
                            themeit=CONFIG.THEME3)
         directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                            icon=CONFIG.ICONBUILDS,
                            themeit=CONFIG.THEME3)
         return
         if 3 - 3: OoOoOO00.Oo0Ooo.I1IiiI / Ii1I
     IiiiI1II1I1, ooIi11iI1i, Ooo, O0o0Oo = check.build_count()
     if 78 - 78:
         iIii1I11I1II1 - Ii1I * OoO0O00 + o0oOOo0O0Ooo + iii1I1I + iii1I1I
     Oo = re.compile(
         'name="(.+?)".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"'
     ).findall(oOoOo00oOo)
     if 11 - 11:
         iii1I1I - OoO0O00 % Oo0ooO0oo0oO % iii1I1I / OoOoOO00 - OoO0O00
     if IiiiI1II1I1 == 1:
         for oo00, o00, Oo0oO0ooo, o0oOoO00o, i1, oOOoo00O0O, i1111, i11, I11, Oo0o0000o0o0 in Oo:
             if not CONFIG.SHOWADULT == 'true' and I11.lower() == 'yes':
                 continue
             if not CONFIG.DEVELOPER == 'true' and test.str_test(oo00):
                 continue
                 if 74 - 74: iii1I1I * O0
             self.view_build(Oo[0][0])
             return
             if 89 - 89: oO0o + Oo0Ooo
     directory.add_file('Versão Kodi: {0}'.format(CONFIG.KODIV),
                        icon=CONFIG.ICONBUILDS,
                        themeit=CONFIG.THEME3)
     directory.add_dir('Menu Salvar Dados', {'mode': 'savedata'},
                       icon=CONFIG.ICONSAVE,
                       themeit=CONFIG.THEME3)
     directory.add_separator()
     if 3 - 3: i1IIi / I1IiiI % I11i * i11iIiiIii / O0 * I11i
     if len(Oo) >= 1:
         if CONFIG.SEPARATE == 'true':
             self._list_all(Oo)
         else:
             if ooIi11iI1i > 0:
                 III1ii1iII = '+' if CONFIG.SHOW19 == 'false' else '-'
                 directory.add_file('[B]{0} Matrix Builds ({1})[/B]'.format(
                     III1ii1iII, ooIi11iI1i), {
                         'mode': 'togglesetting',
                         'name': 'show19'
                     },
                                    themeit=CONFIG.THEME3)
                 if CONFIG.SHOW19 == 'true':
                     self._list_all(Oo, kodiv=19)
                     if 54 - 54: I1IiiI % II111iiii % II111iiii
     elif O0o0Oo > 0:
         if Ooo > 0:
             directory.add_file(
                 'No momento, há apenas construções para adultos',
                 icon=CONFIG.ICONBUILDS,
                 themeit=CONFIG.THEME3)
             directory.add_file(
                 'Habilite Mostrar Adultos em Configurações do Complemento > Diversos',
                 icon=CONFIG.ICONBUILDS,
                 themeit=CONFIG.THEME3)
         else:
             directory.add_file(
                 'Atualmente não há construções oferecidas de {0}'.format(
                     CONFIG.ADDONTITLE),
                 icon=CONFIG.ICONBUILDS,
                 themeit=CONFIG.THEME3)
     else:
         directory.add_file(
             'Arquivo de texto para compilações formatado incorretamente.',
             icon=CONFIG.ICONBUILDS,
             themeit=CONFIG.THEME3)
         if 13 - 13: o0oOOo0O0Ooo.Ii1I
    def show_menu(self, url=None):
        directory.add_dir('Quick Configure advancedsettings.xml', {
            'mode': 'advanced_settings',
            'action': 'quick_configure'
        },
                          icon=CONFIG.ICONMAINT,
                          themeit=CONFIG.THEME3)

        if os.path.exists(CONFIG.ADVANCED):
            directory.add_file('View Current advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'view_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('Remove Current advancedsettings.xml', {
                'mode': 'advanced_settings',
                'action': 'remove_current'
            },
                               icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)

        response = tools.open_url(CONFIG.ADVANCEDFILE)
        url_response = tools.open_url(url)
        local_file = os.path.join(CONFIG.ADDON_PATH, 'resources', 'text',
                                  'advanced.json')

        if url_response:
            TEMPADVANCEDFILE = url_response.text
        elif response:
            TEMPADVANCEDFILE = response.text
        elif os.path.exists(local_file):
            TEMPADVANCEDFILE = tools.read_from_file(local_file)
        else:
            TEMPADVANCEDFILE = None
            logging.log("[Advanced Settings] No Presets Available")

        if TEMPADVANCEDFILE:
            import json

            directory.add_separator(icon=CONFIG.ICONMAINT,
                                    themeit=CONFIG.THEME3)

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

            if advanced_json:
                presets = advanced_json['presets']
                if presets and len(presets) > 0:
                    for preset in presets:
                        name = preset.get('name', '')
                        section = preset.get('section', '')
                        preseturl = preset.get('url', '')
                        icon = preset.get('icon', '')
                        fanart = preset.get('fanart', '')
                        description = preset.get('description', '')

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

                        if section:
                            directory.add_dir(name, {
                                'mode': 'advanced_settings',
                                'url': preseturl
                            },
                                              description=description,
                                              icon=icon,
                                              fanart=fanart,
                                              themeit=CONFIG.THEME3)
                        else:
                            directory.add_file(name, {
                                'mode': 'advanced_settings',
                                'action': 'write_advanced',
                                'name': name,
                                'url': preseturl
                            },
                                               description=description,
                                               icon=icon,
                                               fanart=fanart,
                                               themeit=CONFIG.THEME2)
        else:
            logging.log("[Advanced Settings] URL not working: {0}".format(
                CONFIG.ADVANCEDFILE))
Exemple #23
0
    def view_build(self, name):

        response = tools.open_url(CONFIG.BUILDFILE)

        if response:
            link = tools.clean_text(response.text)
        else:
            directory.add_file('[COLOR azure]URL para archivo txt no válido',
                               themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                               themeit=CONFIG.THEME3)
            return

        if not check.check_build(name, 'version'):
            directory.add_file(
                '[COLOR azure]Error al leer el archivo txt.[COLOR]',
                themeit=CONFIG.THEME3)
            directory.add_file(
                '{0} [COLOR azure]no se encontró en la lista de builds.[COLOR]'
                .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 = '[COLOR azure]{0}[/COLOR] [COLOR white]- v{1}[/COLOR]'.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][ACTUAL 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('[B][COLOR azure]MENU GUARDAR DATOS[/COLOR][/B]',
                              {'mode': 'savedata'},
                              icon=CONFIG.ICONSAVE,
                              themeit=CONFIG.THEME3)
            directory.add_file('[B][COLOR azure]BUILD INFORMACION[/COLOR][/B]',
                               {
                                   'mode': 'buildinfo',
                                   'name': name
                               },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME3)

            if previewcheck:
                directory.add_file('Ver Vista Previa de Video', {
                    'mode': 'buildpreview',
                    'name': name
                },
                                   description=description,
                                   fanart=fanart,
                                   icon=icon,
                                   themeit=CONFIG.THEME3)

            if versioncheck:
                directory.add_file(
                    '[I][COLOR powderblue]Build diseñado para Kodi v{0}[/COLOR] [COLOR azure]( instalado: [COLOR gold]v{1}[/COLOR] )[/COLOR][/I]'
                    .format(str(kodi), str(CONFIG.KODIV)),
                    fanart=fanart,
                    icon=icon,
                    themeit=CONFIG.THEME3)
                directory.add_file(
                    '[I][COLOR azure]Soporte[/COLOR] [COLOR dodgerblue]TELEGRAM:[/COLOR] [I][COLOR azure]https://t.me/beelinkking[/COLOR][/I]'
                    .format(str(kodi), str(CONFIG.KODIV)),
                    fanart=fanart,
                    icon=icon,
                    themeit=CONFIG.THEME3)

            directory.add_separator('[B]INSTALACION BUILD[/B]',
                                    fanart=fanart,
                                    icon=icon,
                                    themeit=CONFIG.THEME3)
            directory.add_file('[B][COLOR azure]- Instalar Build[/COLOR][/B]',
                               {
                                   'mode': 'install',
                                   'action': 'build',
                                   'name': name
                               },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME3)

            if guicheck:
                directory.add_file('Aplicar Corrección gui', {
                    'mode': 'install',
                    'action': 'gui',
                    'name': name
                },
                                   description=description,
                                   fanart=fanart,
                                   icon=icon,
                                   themeit=CONFIG.THEME1)

            if themecheck:
                directory.add_separator('[B]PARCHES MATRIX[/B]',
                                        fanart=fanart,
                                        icon=icon,
                                        themeit=CONFIG.THEME2)

                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 "{0} - Instalado".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.THEME6)
Exemple #24
0
def net_tools():
    directory.add_dir('Speed Test', {'mode': 'speedtest'}, icon=CONFIG.ICONSPEED, themeit=CONFIG.THEME1)
    if CONFIG.HIDESPACERS == 'No':
        directory.add_separator()
    directory.add_dir('View IP Address & MAC Address', {'mode': 'viewIP'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME1)
Exemple #25
0
    def show_menu(self, url=None):
        directory.add_dir('Configuração rápida advancedsettings.xml',
                               {'mode': 'advanced_settings', 'action': 'quick_configure'}, icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)

        if os.path.exists(CONFIG.ADVANCED):
            directory.add_file('Ver atual advancedsettings.xml',
                               {'mode': 'advanced_settings', 'action': 'view_current'}, icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
            directory.add_file('Remover atual advancedsettings.xml',
                               {'mode': 'advanced_settings', 'action': 'remove_current'}, icon=CONFIG.ICONMAINT,
                               themeit=CONFIG.THEME3)
        
        response = tools.open_url(CONFIG.ADVANCEDFILE)
        url_response = tools.open_url(url)
        local_file = os.path.join(CONFIG.ADDON_PATH, 'resources', 'text', 'advanced.json')

        if url_response:
            TEMPADVANCEDFILE = url_response.text
        elif response:
            TEMPADVANCEDFILE = response.text
        elif os.path.exists(local_file):
            TEMPADVANCEDFILE = tools.read_from_file(local_file)
        else:
            TEMPADVANCEDFILE = None
            logging.log("[Configurações avançadas] Sem predefinições disponíveis")
        
        if TEMPADVANCEDFILE:
            import json

            directory.add_separator(icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
            
            try:
                advanced_json = json.loads(TEMPADVANCEDFILE)
            except:
                advanced_json = None
                logging.log("[Configurações avançadas] ERRO: Formato inválido for {0}.".format(TEMPADVANCEDFILE))
                
            if advanced_json:
                presets = advanced_json['presets']
                if presets and len(presets) > 0:
                    for preset in presets:
                        name = preset.get('name', '')
                        section = preset.get('section', False)
                        preseturl = preset.get('url', '')
                        icon = preset.get('icon', CONFIG.ADDON_ICON)
                        fanart = preset.get('fanart', CONFIG.ADDON_FANART)
                        description = preset.get('description', '')

                        if not name:
                            logging.log('[Configurações avançadas] Tag ausente \'name\'', level=xbmc.LOGDEBUG)
                            continue
                        if not preseturl:
                            logging.log('[Configurações avançadas] Tag ausente \'url\'', level=xbmc.LOGDEBUG)
                            continue
                        
                        if section:
                            directory.add_dir(name, {'mode': 'advanced_settings', 'url': preseturl},
                                              description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
                        else:
                            directory.add_file(name,
                                               {'mode': 'advanced_settings', 'action': 'write_advanced', 'name': name,
                                                'url': preseturl},
                                               description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
        else:
            logging.log("[Configurações avançadas] URL não funciona: {0}".format(CONFIG.ADVANCEDFILE))
Exemple #26
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]Version Kodi:[/B] [COLOR azure]{0}[/COLOR] {0}'.format(
                    CONFIG.KODIV),
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)
            directory.add_dir('[B][COLOR azure]MENU GUARDAR DATOS[/COLOR][/B]',
                              {'mode': 'savedata'},
                              icon=CONFIG.ICONSAVE,
                              themeit=CONFIG.THEME3)
            directory.add_separator()
            directory.add_file('URL para archivo txt no valido',
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            return

        total, 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(
            '[B]Version Kodi:[/B] [COLOR azure]{0}[/COLOR]'.format(
                CONFIG.KODIV),
            icon=CONFIG.ICONBUILDS,
            themeit=CONFIG.THEME3)
        directory.add_dir('[B][COLOR azure]MENU GUARDAR DATOS[/COLOR][/B]',
                          {'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 = '[COLOR azure]+[/COLOR]' if CONFIG.SHOW19 == 'false' else '[COLOR azure]-[/COLOR]'
                    directory.add_file(
                        '[B][COLOR dodgerblue]{0} BUILDS:[/COLOR][/B][COLOR azure][B] GTKING[/COLOR] [COLOR lime]MATRIX[/B][/COLOR]'
                        .format(state, count19), {
                            'mode': 'togglesetting',
                            'name': 'show19'
                        },
                        themeit=CONFIG.THEME3)
                    if CONFIG.SHOW19 == 'true':
                        self._list_all(match, kodiv=19)
        elif hidden > 0:
            if adultcount > 0:
                directory.add_file(
                    '[COLOR azure]Actualmente Solo hay Builds para Adultos[COLOR]',
                    icon=CONFIG.ICONBUILDS,
                    themeit=CONFIG.THEME3)
                directory.add_file(
                    '[COLOR azure]Habilitar Mostrar Adultos en los Ajustes de Addon[COLOR] > Misc',
                    icon=CONFIG.ICONBUILDS,
                    themeit=CONFIG.THEME3)
            else:
                directory.add_file(
                    '[COLOR azure]Actualmente No Se Ofrecen Builds de[COLOR] {0}'
                    .format(CONFIG.ADDONTITLE),
                    icon=CONFIG.ICONBUILDS,
                    themeit=CONFIG.THEME3)
        else:
            directory.add_file(
                '[COLOR azure]El archivo de texto para la Build no tiene el formato correcto.[COLOR]',
                icon=CONFIG.ICONBUILDS,
                themeit=CONFIG.THEME3)