Exemplo n.º 1
0
 def addon_menu(self):
     directory.add_file('Remove Addons', {'mode': 'removeaddons'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_dir('Remove Addon Data', {'mode': 'removeaddondata'},
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
     directory.add_dir('Enable/Disable Addons', {'mode': 'enableaddons'},
                       icon=CONFIG.ICONMAINT,
                       themeit=CONFIG.THEME3)
     # directory.add_file('Enable/Disable Adult Addons', 'toggleadult', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
     directory.add_file('Check for Addon Updates', {'mode': 'forceupdate'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
Exemplo n.º 2
0
    def tweaks_menu(self):
        # LEAVING OUT ADVANCED SETTINGS FOR NOW
        #
        # if not CONFIG.ADVANCEDFILE == 'http://' and not CONFIG.ADVANCEDFILE == '':
        #     directory.add_dir('Advanced Settings', 'advancedsetting', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        # else:
        #     if os.path.exists(CONFIG.ADVANCED):
        #         directory.add_file('View Current AdvancedSettings.xml', 'currentsettings', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        #         directory.add_file('Remove Current AdvancedSettings.xml', 'removeadvanced', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        #     directory.add_file('Quick Configure AdvancedSettings.xml', 'autoadvanced', icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)

        directory.add_file('Scan Sources for broken links',
                           {'mode': 'checksources'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Scan For Broken Repositories',
                           {'mode': 'checkrepos'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Remove Non-Ascii filenames',
                           {'mode': 'asciicheck'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_file('Convert Paths to special', {'mode': 'convertpath'},
                           icon=CONFIG.ICONMAINT,
                           themeit=CONFIG.THEME3)
        directory.add_dir('System Information', {'mode': 'systeminfo'},
                          icon=CONFIG.ICONMAINT,
                          themeit=CONFIG.THEME3)
Exemplo n.º 3
0
    def clean_menu(self):
        from resources.libs import clear
        from resources.libs.common import tools

        on = '[B][COLOR springgreen]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 springgreen][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(totalsize)), {'mode': 'fullclean'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        directory.add_file(
            'Clear Cache: [COLOR springgreen][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 springgreen][B]{0}[/B][/COLOR]'.format(
                tools.convert_size(sizepack)), {'mode': 'clearpackages'},
            icon=CONFIG.ICONMAINT,
            themeit=CONFIG.THEME3)
        directory.add_file(
            'Clear Thumbnails: [COLOR springgreen][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 springgreen][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 springgreen]{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'
            includeseren = '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'
            includeseren = 'true' if CONFIG.INCLUDESEREN == '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.seren)'):
                directory.add_file('--- Include Seren: {0}'.format(
                    includeseren.replace('true', on).replace('false', off)), {
                        'mode': 'togglecache',
                        'name': 'includeseren'
                    },
                                   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)
Exemplo n.º 4
0
 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': 'backupbuild'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: GuiFix', {'mode': 'backupgui'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Theme', {'mode': 'backuptheme'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Addon Pack',
                        {'mode': 'backupaddonpack'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Back Up]: Addon_data', {'mode': 'backupaddon'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Build', {'mode': 'restorebuild'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local GuiFix', {'mode': 'restoregui'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Theme', {'mode': 'restoretheme'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Addon Pack',
                        {'mode': 'restoreaddonpack'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: Local Addon_data',
                        {'mode': 'restoreaddon'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Build',
                        {'mode': 'restoreextbuild'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External GuiFix',
                        {'mode': 'restoreextgui'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Theme',
                        {'mode': 'restoreexttheme'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Addon Pack',
                        {'mode': 'restoreextaddonpack'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
     directory.add_file('[Restore]: External Addon_data',
                        {'mode': 'restoreextaddondata'},
                        icon=CONFIG.ICONMAINT,
                        themeit=CONFIG.THEME3)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
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):
            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)
Exemplo n.º 7
0
    def get_listing(self):
        from resources.libs import test

        # if BUILDFILE is a bad URL
        if not self.bf:
            directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_dir('Save Data Menu', {'mode': 'savedata'},
                              icon=CONFIG.ICONSAVE,
                              themeit=CONFIG.THEME3)
            directory.add_separator()
            directory.add_file('URL for txt file not valid',
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            return

        total, count17, count18, count19, adultcount, hidden = check.build_count(
        )

        match = re.compile(
            'name="(.+?)".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"'
        ).findall(self.link)

        if total == 1:
            for name, version, url, gui, kodi, theme, icon, fanart, adult, description in match:
                if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                    continue
                if not CONFIG.DEVELOPER == 'true' and test.str_test(name):
                    continue

                self.view_build(match[0][0])
                return

        directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV),
                           icon=CONFIG.ICONBUILDS,
                           themeit=CONFIG.THEME3)
        directory.add_dir('Save Data Menu', {'mode': 'savedata'},
                          icon=CONFIG.ICONSAVE,
                          themeit=CONFIG.THEME3)
        directory.add_separator()

        if len(match) >= 1:
            if CONFIG.SEPARATE == 'true':
                self._list_all(match)
            else:
                if count19 > 0:
                    state = '+' if CONFIG.SHOW19 == 'false' else '-'
                    directory.add_file('[B]{0} Matrix Builds ({1})[/B]'.format(
                        state, count19), {
                            'mode': 'togglesetting',
                            'name': 'show19'
                        },
                                       themeit=CONFIG.THEME3)
                    if CONFIG.SHOW19 == 'true':
                        self._list_all(match, kodiv=19)
                if count18 > 0:
                    state = '+' if CONFIG.SHOW18 == 'false' else '-'
                    directory.add_file('[B]{0} Leia Builds ({1})[/B]'.format(
                        state, count18), {
                            'mode': 'togglesetting',
                            'name': 'show18'
                        },
                                       themeit=CONFIG.THEME3)
                    if CONFIG.SHOW18 == 'true':
                        self._list_all(match, kodiv=18)
                if count17 > 0:
                    state = '+' if CONFIG.SHOW17 == 'false' else '-'
                    directory.add_file(
                        '[B]{0} Krypton Builds ({1})[/B]'.format(
                            state, count17), {
                                'mode': 'togglesetting',
                                'name': 'show17'
                            },
                        themeit=CONFIG.THEME3)
                    if CONFIG.SHOW17 == 'true':
                        self._list_all(match, kodiv=17)

        elif hidden > 0:
            if adultcount > 0:
                directory.add_file('There is currently only Adult builds',
                                   icon=CONFIG.ICONBUILDS,
                                   themeit=CONFIG.THEME3)
                directory.add_file(
                    'Enable Show Adults in Addon Settings > Misc',
                    icon=CONFIG.ICONBUILDS,
                    themeit=CONFIG.THEME3)
            else:
                directory.add_file(
                    'Currently No Builds Offered from {0}'.format(
                        CONFIG.ADDONTITLE),
                    icon=CONFIG.ICONBUILDS,
                    themeit=CONFIG.THEME3)
        else:
            directory.add_file('Text file for builds not formatted correctly.',
                               icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
Exemplo n.º 8
0
    def view_build(self, name):

        if not self.bf:
            directory.add_file('URL for txt file not valid',
                               themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.BUILDFILE),
                               themeit=CONFIG.THEME3)
            return

        if not check.check_build(name, 'version'):
            directory.add_file('Error reading the txt file.',
                               themeit=CONFIG.THEME3)
            directory.add_file(
                '{0} was not found in the builds list.'.format(name),
                themeit=CONFIG.THEME3)
            return

        match = re.compile(
            'name="%s".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?review="(.+?)".+?dult="(.+?)".+?nfo="(.+?)".+?escription="(.+?)"'
            % name).findall(self.link)

        for version, url, gui, kodi, themefile, icon, fanart, preview, adult, info, description in match:
            build = '{0} (v{1})'.format(name, version)

            updatecheck = CONFIG.BUILDNAME == name and version > CONFIG.BUILDVERSION
            versioncheck = True if float(
                CONFIG.KODIV) == float(kodi) else False
            previewcheck = tools.open_url(preview, check=True)
            guicheck = tools.open_url(gui, check=True)
            themecheck = tools.open_url(themefile, check=True)

            if updatecheck:
                build = '{0} [COLOR red][CURRENT v{1}][/COLOR]'.format(
                    build, CONFIG.BUILDVERSION)

            directory.add_file(build,
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME4)
            directory.add_separator()
            directory.add_dir('Save Data Menu', {'mode': 'savedata'},
                              icon=CONFIG.ICONSAVE,
                              themeit=CONFIG.THEME3)
            directory.add_file('Build Information', {
                'mode': 'buildinfo',
                'name': name
            },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME3)

            if previewcheck:
                directory.add_file('View Video Preview', {
                    'mode': 'buildpreview',
                    'name': name
                },
                                   description=description,
                                   fanart=fanart,
                                   icon=icon,
                                   themeit=CONFIG.THEME3)

            if versioncheck:
                directory.add_file(
                    '[I]Build designed for Kodi v{0} (installed: v{1})[/I]'.
                    format(str(kodi), str(CONFIG.KODIV)),
                    fanart=fanart,
                    icon=icon,
                    themeit=CONFIG.THEME3)

            directory.add_separator('INSTALL')
            directory.add_file('Fresh Install', {
                'mode': 'install',
                'name': name,
                'action': 'fresh'
            },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME1)
            directory.add_file('Standard Install', {
                'mode': 'install',
                'name': name,
                'action': 'normal'
            },
                               description=description,
                               fanart=fanart,
                               icon=icon,
                               themeit=CONFIG.THEME1)

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

            if themecheck:
                directory.add_separator('THEMES', fanart=fanart, icon=icon)

                response = tools.open_url(themefile)
                theme = response.text
                link = tools.clean_text(theme)
                match = re.compile(
                    'name="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"'
                ).findall(link)
                for themename, themeurl, themeicon, themefanart, themeadult, description in match:
                    adultcheck = CONFIG.SHOWADULT != 'true' and themeadult.lower(
                    ) == 'yes'

                    if adultcheck:
                        continue

                    themetitle = themename if not themename == CONFIG.BUILDTHEME else "[B]{0} (Installed)[/B]".format(
                        themename)
                    themeicon = themeicon if tools.open_url(
                        themeicon, check=True) else icon
                    themefanart = themefanart if tools.open_url(
                        themefanart, check=True) else fanart

                    directory.add_file(themetitle, {
                        'mode': 'install',
                        'name': name,
                        'url': themename,
                        'action': 'theme'
                    },
                                       description=description,
                                       fanart=themefanart,
                                       icon=themeicon,
                                       themeit=CONFIG.THEME3)