Beispiel #1
0
 def showMyAccount(self):
     tfctv.checkAccountChange(False)
     categories = [{
         'name': control.lang(56004),
         'url': config.uri.get('profile'),
         'mode': config.MYINFO
     }, {
         'name': control.lang(56005),
         'url': config.uri.get('base'),
         'mode': config.MYSUBSCRIPTIONS
     }, {
         'name': control.lang(56006),
         'url': config.uri.get('base'),
         'mode': config.MYTRANSACTIONS
     }]
     for c in categories:
         self.addDirectoryItem(c.get('name'), c.get('url'), c.get('mode'),
                               control.addonFolderIcon(c.get('name')))
     self.addDirectoryItem(control.lang(56007),
                           config.uri.get('base'),
                           config.LOGOUT,
                           control.addonFolderIcon('Logout'),
                           isFolder=False)
     self.endDirectory()
Beispiel #2
0
    def showMainMenu(self):
        self.addDirectoryItem(control.lang(50204),
                              '/',
                              config.SEARCHMENU,
                              control.addonFolderIcon(control.lang(50204)),
                              isFolder=True,
                              **self.formatMenu())

        # if not logged in, ask to log in
        if control.setting('emailAddress') != '':
            tfctv.checkAccountChange()
            if tfctv.isLoggedIn() == False:
                if (control.confirm(control.lang(57007),
                                    line1=control.lang(57008) %
                                    control.setting('emailAddress'))):
                    (account, logged) = tfctv.checkAccountChange(True)
            elif control.setting('displayMyList') == 'true':
                self.addDirectoryItem(control.lang(50200),
                                      '/',
                                      config.MYLIST,
                                      control.addonFolderIcon(
                                          control.lang(50200)),
                                      isFolder=True,
                                      **self.formatMenu())

        if control.setting('displayWebsiteSections') == 'true':
            self.addDirectoryItem(control.lang(50201),
                                  '/',
                                  config.CATEGORIES,
                                  control.addonFolderIcon(control.lang(50201)),
                                  isFolder=True,
                                  **self.formatMenu())
        else:
            self.showCategories()

        if control.setting('displayWebsiteSections') == 'true':
            control.showNotification(control.lang(57020), control.lang(50008))
            sections = tfctv.getWebsiteHomeSections()
            for s in sections:
                self.addDirectoryItem(s['name'].title(),
                                      str(s['id']),
                                      config.SECTIONCONTENT,
                                      control.addonFolderIcon(
                                          s['name'].title()),
                                      isFolder=True,
                                      **self.formatMenu())

        if control.setting(
                'displayMyAccountMenu'
        ) == 'true' and control.setting('emailAddress') != '':
            self.addDirectoryItem(control.lang(50202),
                                  '/',
                                  config.MYACCOUNT,
                                  control.addonFolderIcon(control.lang(50202)),
                                  isFolder=True,
                                  **self.formatMenu())

        if control.setting('exportToLibrary') == 'true':
            self.addDirectoryItem(control.lang(56023),
                                  '/',
                                  config.EXPORTEDSHOWS,
                                  control.addonFolderIcon(control.lang(56023)),
                                  isFolder=True,
                                  **self.formatMenu())

        if control.setting('displayTools') == 'true':
            self.addDirectoryItem(control.lang(50203), '/', config.TOOLS,
                                  control.addonFolderIcon(control.lang(50203)))

        self.endDirectory()

        if tfctv.isLoggedIn() == False:
            control.infoDialog(control.lang(57017),
                               control.lang(50002),
                               time=8000)