Example #1
0
    def getSeriesList(self):
        searchTitle = self.searchTitle
        tmpList = []
        try:
            results = tvdb.search(searchTitle)
            if len(results) > 0:
                for searchResult in results:
                    movie = tvdb.getMovieInfo(searchResult['id'])
                    _id = movie['Serie'][0]['id']
                    tmpList.append((movie, _id))

        except Exception as e:
            print(e)

        if len(tmpList) > 0:
            self['list'].setList(tmpList)
            self.showSeriesList()
        elif ' - ' in searchTitle:
            self.searchTitle = searchTitle.split(' - ')[0].strip()
            self.getSeriesList()
        else:
            self.updateView(self.SHOW_SERIE_NO_RESULT)
            self['status'].setText(_('Sorry, no data found at TheTVDB.com!'))
            self['status'].show()
            self['thetvdb_logo'].show()
            self['result_txt'].setText('')
            self['result_txt'].hide()
            self['seperator'].show()
            self['key_yellow'].setText(self.MANUAL_SEARCH_TEXT)
            self['button_yellow'].show()
    def showEpisodeList(self, movie):
        searchTitle = self.searchTitle
        self.setTitle(_('Episodes for: %s') % self.getInfoText())
        results = tvdb.search(searchTitle)
        tmpEpisodeList = []
        episodeIndex = -1
        if len(results) > 0:
            try:
                for episode in movie['Episode']:
                    episode_name = ''
                    name = episode['EpisodeName']
                    if name:
                        episode_name = name.encode('utf-8', 'ignore')
                    episode_number = episode['EpisodeNumber']
                    if episode_number:
                        episode_number = episode_number.encode(
                            'utf-8', 'ignore')
                    season_number = episode['SeasonNumber']
                    if season_number:
                        episode_season_number = season_number.encode(
                            'utf-8', 'ignore')
                    id_txt = episode['id']
                    if id_txt:
                        episode_id = id_txt.encode('utf-8', 'ignore')
                    episode_overview = ''
                    overview = episode['Overview']
                    if overview:
                        episode_overview = str(overview).encode(
                            'utf-8', 'ignore')
                    else:
                        episode_overview = _(
                            'Sorry, no description for this episode at TheTVDB.com available!'
                        )
                    if episode_name != '' and self.description != '':
                        if episode_name == self.description:
                            episodeIndex = len(tmpEpisodeList)
                    tmpEpisodeList.append(
                        (episode, episode_name, episode_number,
                         episode_season_number, episode_id, episode_overview))

            except Exception as e:
                print(str(e))

        if len(tmpEpisodeList) > 0:
            self.updateView(self.SHOW_EPISODE_LIST)
            self['episodes_list'].setList(tmpEpisodeList)
            self['episodes_list'].moveSelectionTo(episodeIndex)
            if len(tmpEpisodeList) == 1:
                txt = _('Total %s') % len(tmpEpisodeList) + ' ' + _(
                    'episode found')
            else:
                txt = _('Total %s') % len(tmpEpisodeList) + ' ' + _(
                    'episodes found')
            self['result_txt'].setText(txt)
        else:
            self.updateView(self.SHOW_EPISODE_NO_RESULT)
    def showEpisodeList(self, movie):
        searchTitle = self.searchTitle
        self.setTitle(_("Episodes for: %s") % (self.getInfoText()))
        results = tvdb.search(searchTitle)
        tmpEpisodeList = []
        episodeIndex = -1
        if len(results) > 0:
            try:
                for episode in movie['Episode']:
                    episode_name = ""
                    name = episode['EpisodeName']
                    if name:
                        episode_name = name.encode('utf-8', 'ignore')
                    episode_number = episode['EpisodeNumber']
                    if episode_number:
                        episode_number = episode_number.encode(
                            'utf-8', 'ignore')
                    season_number = episode['SeasonNumber']
                    if season_number:
                        episode_season_number = season_number.encode(
                            'utf-8', 'ignore')
                    id_txt = episode['id']
                    if id_txt:
                        episode_id = id_txt.encode('utf-8', 'ignore')
                    episode_overview = ""
                    overview = episode['Overview']
                    if overview:
                        episode_overview = overview.encode('utf-8', 'ignore')
                    else:
                        episode_overview = (_(
                            "Sorry, no description for this episode at TheTVDB.com available!"
                        ))
                    if episode_name != "" and self.description != "":
                        if episode_name == self.description:
                            episodeIndex = len(tmpEpisodeList)
                    tmpEpisodeList.append(
                        (episode, episode_name, episode_number,
                         episode_season_number, episode_id,
                         episode_overview), )
            except:
                printStackTrace()

        if len(tmpEpisodeList) > 0:
            self.updateView(self.SHOW_EPISODE_LIST)
            self["episodes_list"].setList(tmpEpisodeList)
            self["episodes_list"].moveSelectionTo(episodeIndex)
            if len(tmpEpisodeList) == 1:
                txt = (_("Total %s") % len(tmpEpisodeList) + ' ' +
                       _("episode found"))
            else:
                txt = (_("Total %s") % len(tmpEpisodeList) + ' ' +
                       _("episodes found"))
            self["result_txt"].setText(txt)
        else:
            self.updateView(self.SHOW_EPISODE_NO_RESULT)
 def getSeriesList(self):
     searchTitle = self.searchTitle
     tmpList = []
     try:
         results = tvdb.search(searchTitle)
         if len(results) > 0:
             for searchResult in results:
                 movie = tvdb.getMovieInfo(searchResult['id'])
                 _id = movie['Serie'][0]['id']
                 tmpList.append((movie, _id), )
     except Exception, e:
         print e