Esempio n. 1
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    episodes = favorite_episodes_for_user(user)

    recently_listened = get_latest_episodes(user)

    podcast_ids = [episode.podcast for episode in episodes + recently_listened]
    podcasts = podcasts_to_dict(podcast_ids)

    recently_listened = fetch_episode_data(recently_listened, podcasts=podcasts)
    episodes = fetch_episode_data(episodes, podcasts=podcasts)

    favfeed = FavoriteFeed(user)
    feed_url = favfeed.get_public_url(site.domain)

    podcast = podcast_for_url(feed_url)

    token = request.user.favorite_feeds_token

    return render(request, 'favorites.html', {
        'episodes': episodes,
        'feed_token': token,
        'site': site,
        'podcast': podcast,
        'recently_listened': recently_listened,
        })
Esempio n. 2
0
 def get_favorite_episodes(self, user):
     favorite_episodes = favorite_episodes_for_user(user)
     return fetch_episode_data(favorite_episodes)
Esempio n. 3
0
 def get_recent_episodes(self, user):
     recent_episodes = get_latest_episodes(user)
     return fetch_episode_data(recent_episodes)