Esempio n. 1
0
def get_trakt_show_collection(trakt_list, limit=None):
    """
    Flesh out the different list_types into pyTrakt method calls.

    Call the relevant method, with paramaters if required.
    Return Array of TvShows.
    :param trakt_list: String description of the trakt list to return.
    :returns: Array of PyTrakt TvShow objects.
    """
    try:
        if trakt_list == 'trending':
            return tv.trending_shows(limit=limit, extended='full,images')
        elif trakt_list == 'popular':
            return tv.popular_shows(limit=limit, extended='full,images')
        elif trakt_list == 'anticipated':
            return tv.anticipated_shows(limit=limit, extended='full,images')
        elif trakt_list == 'collected':
            return tv.collected_shows(limit=limit, extended='full,images')
        elif trakt_list == 'watched':
            return tv.watched_shows(limit=limit, extended='full,images')
        elif trakt_list == 'played':
            return tv.played_shows(limit=limit, extended='full,images')
        elif trakt_list == 'recommended':
            return tv.recommended_shows(extended='full,images')
        elif trakt_list == 'newshow':
            calendar_items = calendar.PremiereCalendar(days=30, extended='full,images')
            return [tv_episode.show_data for tv_episode in calendar_items]
        elif trakt_list == 'newseason':
            calendar_items = calendar.SeasonCalendar(days=15, extended='full,images')
            return [tv_episode.show_data for tv_episode in calendar_items]

        return tv.anticipated_shows(limit=limit, extended='full,images')
    except TraktException as error:
        log.warning('Unable to get trakt list {trakt_list}: {error!r}', {'trakt_list': trakt_list, 'error': error})
Esempio n. 2
0
def test_trending_shows():
    shows = trending_shows()
    assert len(shows) == 2
Esempio n. 3
0
def test_trending_shows():
    shows = trending_shows()
    assert len(shows) == 2