Example #1
0
    def favoriteShows(self):
        """
        Fetches data from IMDB to show a list of popular shows.
        """
        t = PageTemplate(rh=self, filename="addShows_favoriteShows.mako")
        e = None

        if self.get_body_argument("submit", None):
            tvdb_user = self.get_body_argument("tvdb_user")
            tvdb_user_key = filters.unhide(
                settings.TVDB_USER_KEY,
                self.get_body_argument("tvdb_user_key"))
            if tvdb_user and tvdb_user_key:
                if tvdb_user != settings.TVDB_USER or tvdb_user_key != settings.TVDB_USER_KEY:
                    favorites.test_user_key(tvdb_user, tvdb_user_key, 1)

        try:
            favorite_shows = favorites.fetch_indexer_favorites()
        except Exception as e:
            logger.exception(traceback.format_exc())
            logger.warning(
                _("Could not get favorite shows: {0}").format(str(e)))
            favorite_shows = None

        return t.render(
            title=_("Favorite Shows"),
            header=_("Favorite Shows"),
            favorite_shows=favorite_shows,
            favorites_exception=e,
            topmenu="home",
            controller="addShows",
            action="popularShows",
        )
Example #2
0
    def favoriteShows(self, tvdb_user=None, tvdb_user_key=None, submit=False):
        """
        Fetches data from IMDB to show a list of popular shows.
        """
        t = PageTemplate(rh=self, filename="addShows_favoriteShows.mako")
        e = None

        tvdb_user_key = filters.unhide(sickbeard.TVDB_USER_KEY, tvdb_user_key)
        if submit and tvdb_user and tvdb_user_key:
            if tvdb_user != sickbeard.TVDB_USER and tvdb_user_key != sickbeard.TVDB_USER:
                favorites.test_user_key(tvdb_user, tvdb_user_key, 1)

        try:
            favorite_shows = favorites.fetch_indexer_favorites()
        except Exception as e:
            logger.log(traceback.format_exc(), logger.ERROR)
            logger.log(
                _("Could not get favorite shows: {0}").format(ex(e)),
                logger.WARNING)
            favorite_shows = None

        return t.render(title=_("Favorite Shows"),
                        header=_("Favorite Shows"),
                        favorite_shows=favorite_shows,
                        favorites_exception=e,
                        topmenu="home",
                        controller="addShows",
                        action="popularShows")