Example #1
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

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

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        'favorites.html',
        {
            'episodes': favorites,
            'feed_token': token,
            'site': site,
            'podcast': podcast,
            'recently_listened': recently_listened,
        },
    )
Example #2
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            "page_user": user,
            "site": site.domain,
            "subscriptions_token":
            user.profile.get_token("subscriptions_token"),
            "favorite_feeds_token":
            user.profile.get_token("favorite_feeds_token"),
            "lists": self.get_podcast_lists(user),
            "subscriptions": self.get_subscriptions(user),
            "recent_episodes": last_played_episodes(user),
            "seconds_played_total": seconds_played(user),
            "seconds_played_month": seconds_played(user, month_ago),
            "favorite_episodes": FavoriteEpisode.episodes_for_user(user),
            "num_played_episodes_total": num_played_episodes(user),
            "num_played_episodes_month": num_played_episodes(user, month_ago),
        }

        return render(request, "userpage.html", context)
Example #3
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            'page_user': user,
            'flattr_username':
            user.profile.settings.get_wksetting(FLATTR_USERNAME),
            'site': site.domain,
            'subscriptions_token':
            user.profile.get_token('subscriptions_token'),
            'favorite_feeds_token':
            user.profile.get_token('favorite_feeds_token'),
            'lists': self.get_podcast_lists(user),
            'subscriptions': self.get_subscriptions(user),
            'recent_episodes': last_played_episodes(user),
            'seconds_played_total': seconds_played(user),
            'seconds_played_month': seconds_played(user, month_ago),
            'favorite_episodes': FavoriteEpisode.episodes_for_user(user),
            'num_played_episodes_total': num_played_episodes(user),
            'num_played_episodes_month': num_played_episodes(user, month_ago),
        }

        return render(request, 'userpage.html', context)
Example #4
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

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

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        "favorites.html",
        {
            "episodes": favorites,
            "feed_token": token,
            "site": site,
            "podcast": podcast,
            "recently_listened": recently_listened,
        },
    )
Example #5
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

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

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        'favorites.html',
        {
            'episodes': favorites,
            'feed_token': token,
            'site': site,
            'podcast': podcast,
            'recently_listened': recently_listened,
        },
    )
Example #6
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            'page_user': user,
            'site': site.domain,
            'subscriptions_token': user.profile.get_token('subscriptions_token'),
            'favorite_feeds_token': user.profile.get_token('favorite_feeds_token'),
            'lists': self.get_podcast_lists(user),
            'subscriptions': self.get_subscriptions(user),
            'recent_episodes': last_played_episodes(user),
            'seconds_played_total': seconds_played(user),
            'seconds_played_month': seconds_played(user, month_ago),
            'favorite_episodes': FavoriteEpisode.episodes_for_user(user),
            'num_played_episodes_total': num_played_episodes(user),
            'num_played_episodes_month': num_played_episodes(user, month_ago),
        }

        return render(request, 'userpage.html', context)
Example #7
0
def favorites(request, username):
    favorites = FavoriteEpisode.episodes_for_user(request.user)
    domain = RequestSite(request).domain
    e_data = lambda e: episode_data(e, domain)
    ret = list(map(e_data, favorites))
    return JsonResponse(ret)
Example #8
0
 def get_episodes(self):
     return FavoriteEpisode.episodes_for_user(self.user)
Example #9
0
 def get_episodes(self):
     return FavoriteEpisode.episodes_for_user(self.user)
Example #10
0
def favorites(request, username):
    favorites = FavoriteEpisode.episodes_for_user(request.user)
    domain = RequestSite(request).domain
    e_data = lambda e: episode_data(e, domain)
    ret = list(map(e_data, favorites))
    return JsonResponse(ret)