def set_favorite(self, talkID, is_favorite):
     """
     talkID ID for the talk.
     is_favorite True to set as a favorite, False to unset.
     """
     if login(self.user, settings.username, settings.password):
         favorites = Favorites(plugin.report, self.get_HTML)
         if is_favorite:
             successful = favorites.addToFavorites(talkID)
         else:
             successful = favorites.removeFromFavorites(talkID)
         notification_messages = {(True, True): 30091, (True, False): 30092, (False, True): 30094, (False, False): 30095}
         notification_message = notification_messages[(is_favorite, successful)]
         xbmc.executebuiltin('Notification(%s,%s,)' % (plugin.getLS(30000), plugin.getLS(notification_message)))
 def showCategories(self):
     self.addItem(plugin.getLS(30001), 'newTalksRss', video_info={'Plot':plugin.getLS(30031)})
     self.addItem(plugin.getLS(30002), 'speakers', video_info={'Plot':plugin.getLS(30032)})
     self.addItem(plugin.getLS(30003), 'themes', video_info={'Plot':plugin.getLS(30033)})
     #self.addItemplugin.({'Title':getLS(30004), 'mode':'search', 'Plot':getLS(30034)})
     if settings.username:
         self.addItem(plugin.getLS(30005), 'favorites', video_info={'Plot':plugin.getLS(30035)})
     self.endofdirectory()
 def downloadVid(self, url):
     video = self.ted_talks.getVideoDetails(url)
     if settings.download_mode == 'true':
         downloadPath = xbmcgui.Dialog().browse(3, plugin.getLS(30096), 'files')
     else:
         downloadPath = settings.download_path
     if downloadPath:
         Download(plugin.getLS, video['Title'], video['url'], downloadPath)
Пример #4
0
    def run_internal(self, args):
        keyboard = xbmc.Keyboard(settings.get_current_search(), plugin.getLS(30004))
        keyboard.doModal()

        if not keyboard.isConfirmed():
            return

        search_term = keyboard.getText()
        settings.set_current_search(search_term)
        self.__add_items__(search_term, 1, [], False)
    def run_internal(self, args):
        keyboard = xbmc.Keyboard(settings.get_current_search(), plugin.getLS(30004))
        keyboard.doModal()

        if not keyboard.isConfirmed():
            return

        search_term = keyboard.getText()
        settings.set_current_search(search_term)
        self.__add_items__(search_term, 1, [], False)
    def __add_items__(self, search_term, page, current_items, update_listing):
        talks_generator = Search(self.get_HTML).get_talks_for_search(search_term, page)
        remaining_talks = itertools.islice(talks_generator, 1).next()
        search_results = list(itertools.chain(current_items, talks_generator))
        for title, link, img in search_results:
            self.ui.addItem(title, 'playVideo', link, img, isFolder=False)
        if remaining_talks:
            self.ui.addItem(plugin.getLS(30022), 'searchMore', args={'search_term': search_term, 'page': str(page + 1)})
        self.ui.endofdirectory(sortMethod='none', updateListing=update_listing)

        return search_results
Пример #7
0
    def __add_items__(self, search_term, page, current_items, update_listing):
        talks_generator = Search(self.get_HTML).get_talks_for_search(search_term, page)
        remaining_talks = itertools.islice(talks_generator, 1).next()
        search_results = list(itertools.chain(current_items, talks_generator))
        for title, link, img in search_results:
            self.ui.addItem(title, 'playVideo', link, img, isFolder=False)
        if remaining_talks:
            self.ui.addItem(plugin.getLS(30022), 'searchMore', args={'search_term': search_term, 'page': str(page + 1)})
        self.ui.endofdirectory(sortMethod='none', updateListing=update_listing)

        return search_results
 def showCategories(self):
     self.addItem(plugin.getLS(30001),
                  'newTalksRss',
                  video_info={'Plot': plugin.getLS(30031)})
     self.addItem(plugin.getLS(30002),
                  'speakers',
                  video_info={'Plot': plugin.getLS(30032)})
     self.addItem(plugin.getLS(30004) + "...",
                  'search',
                  video_info={'Plot': plugin.getLS(30034)})
     self.addItem(plugin.getLS(30007),
                  'topics',
                  video_info={'Plot': plugin.getLS(30033)})
     self.endofdirectory()
 def navItems(self, navItems, mode):
     if navItems['next']:
         self.addItem(plugin.getLS(30020), mode, navItems['next'])
     if navItems['previous']:
         self.addItem(plugin.getLS(30021), mode, navItems['previous'])
 def navItems(self, navItems, mode):
     if navItems['next']:
         self.addItem(plugin.getLS(30020), mode, navItems['next'])
     if navItems['previous']:
         self.addItem(plugin.getLS(30021), mode, navItems['previous'])
def login(user_scraper, username, password):
    user_details = user_scraper.login(username, password)
    if not user_scraper:
        xbmcgui.Dialog().ok(plugin.getLS(30050), plugin.getLS(30051))
    return user_details
 def speakerGroups(self):
     for i in range(65, 91):
         letter = chr(i)
         self.addItem(plugin.getLS(30006) + letter, 'speakerGroup', letter, isFolder=True)
     self.endofdirectory()
 def showCategories(self):
     self.addItem(plugin.getLS(30001), 'newTalksRss', video_info={'Plot':plugin.getLS(30031)})
     self.addItem(plugin.getLS(30002), 'speakers', video_info={'Plot':plugin.getLS(30032)})
     self.addItem(plugin.getLS(30003), 'themes', video_info={'Plot':plugin.getLS(30033)})
     self.addItem(plugin.getLS(30004) + "...", 'search', video_info={'Plot':plugin.getLS(30034)})
     self.endofdirectory()