Example #1
0
 def jsonMenu(self,
              menufile,
              menusection,
              menuContent='addons',
              menuSort=control.xDirSort.NoSort,
              menuCategory=None):
     rootMenu = jsonmenu.jsonMenu()
     rootMenu.load(menufile)
     rootMenu.process(menusection)
     self.endDirectory(contentType=menuContent,
                       sortMethod=menuSort,
                       category=menuCategory)
Example #2
0
    def get(self, mFile, mSection):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load(mFile)
        rootMenu.process(mSection)

        if mSection == 'boxsets_main':
            self.endDirectory(category='Boxsets')
        else:
            mSection = mSection.split('_')[1].capitalize()
            self.endDirectory(contentType='movies',
                              sortMethod=control.xDirSort.Label,
                              category=mSection)
Example #3
0
    def root(self):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('channels')

        for item in rootMenu.menu['tvtap_categories']:
            try:
                name = item['title']
                id = item['cid']
                try:
                    icon = self.icon_url % (item['thumbnail'])
                except Exception:
                    icon = addonIcon
                link = 'tvtapCat&url=%s' % (id)
                self.addDirectoryItem(name, link, icon, icon)
            except Exception:
                pass

        self.endDirectory(sortMethod=control.xDirSort.Label, category='TV Tap')
Example #4
0
    def root(self):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('channels')

        for item in rootMenu.menu['swift_categories']:
            try:
                title = utils.convert(item['title']).encode('utf-8')
                if self.filter_mov == 'true' and 'vod' in item['cattype']:
                    continue
                if self.filter_spo == 'true' and 'sports' in title.lower():
                    continue
                if self.filter_tvl == 'true' and 'live' in item['cattype']:
                    continue
                id = item['cid']

                icon = item['thumbnail']
                link = 'swiftCat&url=%s' % (id)
                self.addDirectoryItem(title, link, icon, icon)
            except Exception:
                failure = traceback.format_exc()
                log_utils.log('Channels - Failed to Build: \n' + str(failure))

        self.endDirectory(sortMethod=control.xDirSort.Label,
                          category='Swift Streamz TV')
Example #5
0
 def root(self):
     rootMenu = jsonmenu.jsonMenu()
     rootMenu.load('pbskids')
     rootMenu.process('pbskids')
     self.endDirectory(sortMethod=control.xDirSort.Label,
                       category='PBS Kids')
Example #6
0
 def pb_root(self):
     rootMenu = jsonmenu.jsonMenu()
     rootMenu.load('podcast')
     rootMenu.process('podbay_root')
     self.endDirectory(category='Podbay.fm')
Example #7
0
 def pco_root(self):
     rootMenu = jsonmenu.jsonMenu()
     rootMenu.load('podcast')
     rootMenu.process('podcastone_root')
     self.endDirectory(category='PodcastOne')
Example #8
0
    def root(self):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('main')

        for item in rootMenu.menu['main_menu']:
            try:
                '''
                First things first, let's see if this is an entry with on/off settings and if we should display it.
                '''
                try:
                    toggle = item.get('toggle', None)
                    if toggle is not None:
                        if self.getMenuEnabled(toggle) is False:
                            continue
                except Exception:
                    pass
                '''
                Language file support can be done this way
                '''
                title = item.get('title', 'No Title Given')
                tcheck = title
                try:
                    title = control.lang(int(title)).encode('utf-8')
                except Exception:
                    pass
                '''
                Check to see if is a My Lists entry and skip if not enabled
                '''
                try:
                    if tcheck == '32003' or tcheck == '32004':
                        if control.setting('lists.widget') == '0':
                            continue
                except Exception:
                    pass
                '''
                Check to see if is New Movies and skip if not enabled
                '''
                try:
                    if tcheck == '32005':
                        theSetting = control.setting('movie.widget')
                        if theSetting == '0':
                            continue
                        if theSetting == '1':
                            title = title + " (" + control.lang(32321).encode(
                                'utf-8') + ")"
                        elif theSetting == '2':
                            title = title + " (" + control.lang(32322).encode(
                                'utf-8') + ")"
                        elif theSetting == '3':
                            title = title + " (" + control.lang(32323).encode(
                                'utf-8') + ")"
                        elif theSetting == '4':
                            title = title + " (" + control.lang(32324).encode(
                                'utf-8') + ")"
                        elif theSetting == '5':
                            title = title + " (" + control.lang(32580).encode(
                                'utf-8') + ")"
                except Exception:
                    pass
                '''
                Check to see if is New Episodes entry and skip if not enabled
                '''
                try:
                    if tcheck == '32006':
                        if (traktIndicators is True
                                and control.setting('tv.widget.alt') == '0'
                            ) or (traktIndicators is False
                                  and control.setting('tv.widget') == '0'):
                            continue
                except Exception:
                    pass
                '''
                Check to see if is Downloads entry and skip if not enabled
                '''
                try:
                    if tcheck == '32009':
                        downloads = True if control.setting(
                            'downloads') == 'true' and (len(
                                control.listDir(
                                    control.setting('movie.download.path'))[0]
                            ) > 0 or len(
                                control.listDir(
                                    control.setting('tv.download.path'))[0]) >
                                                        0) else False
                        if downloads is False:
                            continue
                except Exception:
                    pass

                icon = item['thumbnail']
                link = item.get('action', None)

                try:
                    menu_file = item.get('menu_file', None)
                    menu_section = item.get('menu_section', None)
                    link = '%s&menu_file=%s&menu_section=%s' % (
                        link, menu_file,
                        menu_section) if menu_file is not None else link
                except Exception:
                    pass

                try:
                    link = '%s&menu_title=%s' % (link, title)
                except Exception:
                    pass

                try:
                    menu_sort = item.get('menu_sort', None)
                    link = '%s&menu_sort=%s' % (
                        link, menu_sort) if menu_sort is not None else link
                except Exception:
                    pass

                self.addDirectoryItem(title, link, icon, icon)
            except Exception:
                pass

        self.endDirectory()

        newsUpdate = control.setting('NewsUpdate')
        if newsUpdate == '':
            newsUpdate = 1
        else:
            newsUpdate = int(float(newsUpdate))
        if time.time() < newsUpdate:
            return
        newsUpdate = time.time() + (60 * 60 * 24 * 7)
        control.setSetting('NewsUpdate', str(newsUpdate))

        from resources.lib.dialogs import news
        news.load()
Example #9
0
    def mymovies(self, lite=False):
        self.accountCheck()

        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('movies')

        for item in rootMenu.menu['mymovies_menu']:
            try:
                '''
                First things first, let's see if this is an entry with on/off settings and if we should display it.
                '''
                try:
                    toggle = item.get('toggle', None)
                    if toggle is not None:
                        if self.getMenuEnabled(toggle) is False:
                            continue
                except Exception:
                    pass
                '''
                Language file support can be done this way
                '''
                title = item.get('title', 'No Title Given')
                tcheck = title
                try:
                    title = control.lang(int(title)).encode('utf-8')
                except Exception:
                    pass

                requires_trakt = item.get('req_trakt', None)
                requires_imdb = item.get('req_imdb', None)
                try:
                    if requires_trakt == '1':
                        if traktCredentials is False:
                            continue
                        if item.get('trakt_indicator',
                                    None) == '1' and traktIndicators is False:
                            continue
                        title = "Trakt " + title
                    elif requires_imdb == '1':
                        if imdbCredentials is False:
                            continue
                        title = "IMDB " + title
                except Exception:
                    pass

                try:
                    if (tcheck == '32028' or tcheck == '32010'
                            or tcheck == '32031') and lite is True:
                        continue
                except Exception:
                    pass

                icon = item['thumbnail']
                link = item.get('action', None)

                try:
                    url = item.get('url', None)
                    link = '%s&url=%s' % (link,
                                          url) if url is not None else link
                except Exception:
                    pass
                try:
                    menu_file = item.get('menu_file', None)
                    menu_section = item.get('menu_section', None)
                    link = '%s&menu_file=%s&menu_section=%s' % (
                        link, menu_file,
                        menu_section) if menu_file is not None else link
                except Exception:
                    pass

                if item.get('queue', None) == '1':
                    queue = True
                else:
                    queue = False

                context = item.get('context', None)
                if context is not None:
                    context = context.split('|', 1)
                    context = (int(context[0]), context[1])

                self.addDirectoryItem(title,
                                      link,
                                      icon,
                                      icon,
                                      queue=queue,
                                      context=context)
            except Exception:
                pass

        self.endDirectory(category=control.lang(32003).encode('utf-8'))
Example #10
0
    def movies(self, lite=False):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('movies')

        for item in rootMenu.menu['movie_menu']:
            try:
                '''
                First things first, let's see if this is an entry with on/off settings and if we should display it.
                '''
                try:
                    toggle = item.get('toggle', None)
                    if toggle is not None:
                        if self.getMenuEnabled(toggle) is False:
                            continue
                except Exception:
                    pass
                '''
                Language file support can be done this way
                '''
                title = item.get('title', 'No Title Given')
                tcheck = title
                try:
                    title = control.lang(int(title)).encode('utf-8')
                except Exception:
                    pass
                '''
                Check to see if is a My Lists entry and skip if not enabled
                '''
                try:
                    if tcheck == '32003':
                        if control.setting(
                                'lists.widget') == '0' and lite is True:
                            continue
                except Exception:
                    pass
                '''
                Check to see if is Lite shit and skip as required
                '''
                try:
                    if (tcheck == '32028'
                            or tcheck == '32010') and lite is True:
                        continue
                except Exception:
                    pass

                icon = item['thumbnail']
                link = item.get('action', None)

                try:
                    url = item.get('url', None)
                    link = '%s&url=%s' % (link,
                                          url) if url is not None else link
                except Exception:
                    pass
                try:
                    menu_file = item.get('menu_file', None)
                    menu_section = item.get('menu_section', None)
                    link = '%s&menu_file=%s&menu_section=%s' % (
                        link, menu_file,
                        menu_section) if menu_file is not None else link
                except Exception:
                    pass

                self.addDirectoryItem(title, link, icon, icon)
            except Exception:
                pass

        self.endDirectory(category=control.lang(32001).encode('utf-8'))
Example #11
0
 def root(self):
     rootMenu = jsonmenu.jsonMenu()
     rootMenu.load('documentary')
     rootMenu.process('documentaries_root')
     self.endDirectory(category='Documentaries')