def onInit(self):

        if self.landing_page.result_code == HOME_SCREEN_CODE:
            self.close()

        else:

            self.setVisible(LOADING_SCREEN, True)

            self.runDirectoryChecks()
            self.setButtonStates()
            self.setSelectedContent()

            if self.currentPanel is not None and self.currentIndex is not None:

                try:
                    xbmc.executebuiltin('Control.SetFocus(%s, %s)' %
                                        (self.currentPanel, self.currentIndex))

                except:
                    pass

            utils.unlock()

            self.setVisible(LOADING_SCREEN, False)
    def onInit(self):

        self.setLoginObjectSizes()
        self.setVisible(LOGIN_MASK_BTN, True)

        #https://github.com/MediaBrowser/plugin.video.emby/blob/develop/resources/lib/dialogs/loginconnect.py

        utils.unlock()
Exemple #3
0
    def onInit(self):

        self.runDirectoryChecks()
        self.clearLists(0)

        self.getMenuitem(ABOUT_BTN)

        utils.unlock()

        self.setVisible(LOADING_SCREEN, False)
Exemple #4
0
    def onInit(self):

        if self.landing_page and self.landing_page.result_code in (HOME_SCREEN_CODE, EXIT_CODE, LOGOUT_CODE):
            self.close();

        else:

            self.runDirectoryChecks();
            self.getGenres();

            try:
                xbmc.executebuiltin('Control.SetFocus(%s, %s)' % (PANEL_LIST, self.currentposition));

            except:
                pass;

            utils.unlock();
    def onInit(self):

        if self.previousWindow:
            self.previousWindow.close()

        if self.result_code == HOME_SCREEN_CODE:
            self.result_code = REST_CODE

        elif self.result_code in (LOGOUT_CODE, EXIT_CODE):

            self.landing_page = None
            self.close()

        self.runDirectoryChecks()

        self.password_string = ''
        self.password_length = 0

        self.buildDetails()

        utils.unlock()
    def onInit(self):

        self.setVisible(LOADING_SCREEN, True)

        if self.landing_page and self.landing_page.result_code in (
                HOME_SCREEN_CODE, EXIT_CODE, LOGOUT_CODE):
            self.close()

        else:

            self.runDirectoryChecks()
            self.initateSearch()

            try:
                xbmc.executebuiltin('Control.SetFocus(%s, %s)' %
                                    (PANEL_LIST, self.currentposition))

            except:
                pass

            utils.unlock()

            self.setVisible(LOADING_SCREEN, False)
def settings(landing_page, parent, child, controlID):

    RESULT_CODE = REST_CODE

    try:

        #xbmc.executebuiltin('Addon.OpenSettings(%s)' % utils.getAddonInfo('id'));
        utils.addon.openSettings()

        utils.lock()
        utils.sleep(2000)
        utils.unlock()

        addon_data = xbmc.translatePath(
            utils.getAddonInfo('profile')).decode('utf-8')
        tokens = xbmc.translatePath(os.path.join(addon_data, 'tokens.db'))

        if not os.path.exists(tokens):
            RESULT_CODE = LOGOUT_CODE

    except Exception as inst:
        logger.error(inst)

    return RESULT_CODE
    def onClick(self, controlID):

        if controlID == MENU_BTN:
            self.close()

        elif controlID in NAV_BUTTONS:

            self.currentChoice = NAV_BUTTONS.index(controlID)
            self.setButtonStates()
            self.setSelectedContent()

        elif controlID in PANEL_LISTS:

            listitem = self.getControl(controlID).getSelectedItem()

            self.currentPanel = controlID
            self.currentIndex = self.getControl(
                controlID).getSelectedPosition()

            if self.isEmpty is False:

                if controlID == QUEUE_PANEL_LIST:

                    try:

                        from resources.lib.gui.showgui import show

                        xrfPath = listitem.getProperty('detailPath')
                        xrfParam = listitem.getProperty('detailParams')

                        show(self.landing_page, xrfPath, xrfParam)

                    except Exception as inst:
                        self.logger.error(inst)

                elif controlID == HISTORY_PANEL_LIST:

                    utils.lock()

                    path = listitem.getProperty('path')
                    params = listitem.getProperty('params')

                    sDetails = funimationnow.selection(path, params,
                                                       'episodeDesc',
                                                       self.currentValue, 0,
                                                       False)

                    if sDetails:

                        videourl = sDetails.get('videourl', None)
                        closedCaptionUrl = sDetails.get(
                            'closedCaptionUrl', None)

                        if videourl:

                            from resources.lib.modules.player import player

                            try:

                                contMap = self.contentMaps.get(
                                    self.currentValue).get('config')

                                if contMap:

                                    pStart = contMap.get(
                                        'startPosition', None)
                                    pDuration = contMap.get('duration', None)
                                    pAdd = contMap.get('add', None)

                                    if pStart and pDuration and pAdd:

                                        listitem.setProperty(
                                            'pStart', str(pStart))
                                        listitem.setProperty(
                                            'pDuration', str(pDuration))
                                        listitem.setProperty(
                                            'pAdd', str(pAdd))

                                        if closedCaptionUrl:
                                            listitem.setSubtitles(
                                                [closedCaptionUrl])

                            except:
                                pass

                            utils.unlock()

                            player().run(videourl, listitem)

                    utils.unlock()

        elif controlID in SIDE_MENU:
            self.menuNavigation(controlID)
    def setHomeScreenItems(self, pointers):

        #20000 - 20009
        #20500 - 20509

        utils.lock()
        #UI Locking is bad we want some kind of non locking notification for the main gui

        self.resetListContents()

        self.logger.debug('SETTING HOMESCREEN ITEMS')

        #sysaddon = sys.argv[0];
        #syshandle = int(sys.argv[1]);

        threads = []
        idx = 0

        for tidx, pointer in enumerate(pointers, 0):

            try:

                itemset = None
                longList = None
                navmenu = None

                #processes = [];

                mid = int('200%02d' % idx)
                lid = int('205%02d' % idx)
                qid = int('206%02d' % idx)

                if 'themes' in pointer:

                    if 'funType' in pointer:  #API Keeps changing, it appears they are adding device specific content in a poor fashion

                        funType = utils.parseValue(pointer, ['funType'])

                        #if funType == 'carousel_hero mobile-spotlight':
                        if funType == 'carousel_hero mobile-spotlight-android':
                            itemset = funimationnow.contentCarousel(
                                pointer, idx)

                        else:
                            continue

                elif 'longList' in pointer:

                    longList = pointer['longList']

                    if 'watchlist' in longList:
                        itemset = funimationnow.watchlist(pointer=pointer,
                                                          idx=idx)

                        if itemset and len(itemset) >= 4:

                            if itemset[2]:

                                mid = int('200%02d' % idx)

                                self.menus.update({mid: itemset[2]})

                                self.mkeys.update({itemset[0]: mid})

                                self.updates.update({mid: itemset[4]})

                            self.navigation.update({
                                mid:
                                dict({
                                    'navset': itemset[3],
                                    'navtype': 'watchlist'
                                })
                            })

                    else:

                        if 'themes' in longList:

                            dset = self.menus.get(
                                self.mkeys.get('history', None), None)
                            itemset = funimationnow.episode(
                                pointer, idx, dset)

                        else:

                            dset = self.menus.get(
                                self.mkeys.get('myqueue', None), None)
                            itemset = funimationnow.show(pointer, idx, dset)

                        if itemset:

                            if bool(
                                    re.compile(r'.*showGenres=true.*',
                                               re.I).match(itemset[2].get(
                                                   'params', ''))):
                                navType = 'genres'

                            else:
                                navType = 'dateadded'

                            self.navigation.update({
                                mid:
                                dict({
                                    'navset': itemset[2],
                                    'navtype': navType
                                })
                            })

                            #success = ['shows', shows, navigation];

                if itemset:
                    self.formatItemSet(threads, itemset, mid, lid, qid)

                try:

                    vset = [[
                        int('200%02d' % idx),
                        int('220%02d' % idx),
                        int('205%02d' % idx)
                    ], [int('900%02d' % idx)]]

                    self.setLoadingStates(vset, False)

                except Exception as inst:
                    self.logger.error(inst)

            except Exception as inst:
                self.logger.error(inst)

            idx += 1

        #See Line 696 & 812.  This is assigned to something, and should not be marked as an error
        [i.start() for i in threads]
        #[i.join() for i in threads];

        utils.unlock()

        self.logger.debug(self.navigation)
    def setMenuItems(self, menuitems):

        #1001 - 1009

        utils.lock()

        idxoffset = 0

        for idx, menu in enumerate(menuitems, 1):

            try:

                if 'ratethisapp' != menu['target']:

                    title = None
                    target = None
                    path = None
                    params = None
                    size = None
                    fsize = None

                    if 'register' == menu['target']:

                        smenu = menu['registration']['registered']

                        title = smenu['title']
                        target = smenu['pointer']['target']
                        path = smenu['pointer']['path']
                        params = None

                    else:

                        title = menu['title']
                        target = menu['target']
                        path = menu['path']
                        params = menu['params']

                    self.menus.update({
                        int('100%s' % (idx + idxoffset)):
                        dict({
                            'title': title,
                            'target': target,
                            'path': path,
                            'params': params
                        })
                    })

                    size = (600, 60) if 'themes' in menu else (600, 90)
                    fsize = 36 if 'themes' in menu else 58

                    utils.text2Button(
                        title, 'RGB', [(61, 3, 136),
                                       (68, 3, 151)], [(255, 255, 255),
                                                       (255, 255, 255)], fsize,
                        'ExtraBold', size, (20, 4), [
                            'menu-focus-button%s' % (idx + idxoffset),
                            'menu-no-focus-button%s' % (idx + idxoffset)
                        ], True)

                else:
                    idxoffset += -1

            except Exception as inst:
                self.logger.error(inst)

        utils.unlock()