Esempio n. 1
0
def podcast(request, podcast):

    if not check_publisher_permission(request.user, podcast):
        return HttpResponseForbidden()

    timeline_data = listener_data([podcast])
    subscription_data = subscriber_data([podcast])[-20:]

    update_token = request.user.profile.get_token('publisher_update_token')

    heatmap = EpisodeHeatmap(podcast)

    try:
        pubsubscription = HubSubscription.objects.get(topic_url=podcast.url)
    except HubSubscription.DoesNotExist:
        pubsubscription = None

    site = RequestSite(request)
    feedurl_quoted = urllib.quote(podcast.url)

    return render(request, 'publisher/podcast.html', {
        'site': site,
        'podcast': podcast,
        'group': podcast.group,
        'form': None,
        'timeline_data': timeline_data,
        'subscriber_data': subscription_data,
        'update_token': update_token,
        'heatmap': heatmap,
        'feedurl_quoted': feedurl_quoted,
        'pubsubscription': pubsubscription,
        })
Esempio n. 2
0
File: views.py Progetto: fk-lx/mygpo
def podcast(request, podcast):

    if not check_publisher_permission(request.user, podcast):
        return HttpResponseForbidden()

    timeline_data = listener_data([podcast])
    subscription_data = subscriber_data([podcast])[-20:]

    if podcast.group:
        group = podcastgroup_by_id(podcast.group)
    else:
        group = None

    update_token = request.user.publisher_update_token

    heatmap = EpisodeHeatmap(podcast.get_id())

    pubsubscription = subscription_for_topic(podcast.url)

    site = RequestSite(request)
    feedurl_quoted = urllib.quote(podcast.url)

    return render(request, 'publisher/podcast.html', {
        'site': site,
        'podcast': podcast,
        'group': group,
        'form': None,
        'timeline_data': timeline_data,
        'subscriber_data': subscription_data,
        'update_token': update_token,
        'heatmap': heatmap,
        'feedurl_quoted': feedurl_quoted,
        'pubsubscription': pubsubscription,
        })
Esempio n. 3
0
def podcast(request, podcast):

    if not check_publisher_permission(request.user, podcast):
        return HttpResponseForbidden()

    timeline_data = listener_data([podcast])
    subscription_data = subscriber_data([podcast])[-20:]

    update_token = request.user.profile.get_token('publisher_update_token')

    try:
        pubsubscription = HubSubscription.objects.get(topic_url=podcast.url)
    except HubSubscription.DoesNotExist:
        pubsubscription = None

    site = RequestSite(request)
    feedurl_quoted = urllib.parse.quote(podcast.url)

    return render(
        request, 'publisher/podcast.html', {
            'site': site,
            'podcast': podcast,
            'group': podcast.group,
            'form': None,
            'timeline_data': timeline_data,
            'subscriber_data': subscription_data,
            'update_token': update_token,
            'feedurl_quoted': feedurl_quoted,
            'pubsubscription': pubsubscription,
        })
Esempio n. 4
0
File: views.py Progetto: fk-lx/mygpo
def group(request, group):

    podcasts = group.podcasts

    # users need to have publisher access for at least one of the group's podcasts
    if not any([check_publisher_permission(request.user, p) for p in podcasts]):
        return HttpResponseForbidden()

    timeline_data = listener_data(podcasts)
    subscription_data = list(subscriber_data(podcasts))[-20:]

    return render(request, 'publisher/group.html', {
        'group': group,
        'timeline_data': timeline_data,
        'subscriber_data': subscription_data,
        })
Esempio n. 5
0
def group(request, group):

    podcasts = group.podcasts

    # users need to have publisher access for at least one of the group's podcasts
    if not any([check_publisher_permission(request.user, p) for p in podcasts]):
        return HttpResponseForbidden()

    timeline_data = listener_data(podcasts)
    subscription_data = list(subscriber_data(podcasts))[-20:]

    return render(request, 'publisher/group.html', {
        'group': group,
        'timeline_data': timeline_data,
        'subscriber_data': subscription_data,
        })
Esempio n. 6
0
File: views.py Progetto: Mic92/mygpo
def podcast(request, podcast):

    if not check_publisher_permission(request.user, podcast):
        return HttpResponseForbidden()

    timeline_data = listener_data([podcast])
    subscription_data = subscriber_data([podcast])[-20:]

    if podcast.group:
        group = PodcastGroup.get(podcast.group)
    else:
        group = None

#    if request.method == 'POST':
#        form = NonePodcastForm(request.POST, instance=p)
#        if form.is_valid():
#            form.save()

#    elif request.method == 'GET':
#        form = PodcastForm(instance=p)

    if 'new_token' in request.GET:
        request.user.create_new_token('publisher_update_token')
        request.user.save()

    update_token = request.user.publisher_update_token

    heatmap = EpisodeHeatmap(podcast.get_id())

    site = RequestSite(request)

    return render(request, 'publisher/podcast.html', {
        'site': site,
        'podcast': podcast,
        'group': group,
        'form': None,
        'timeline_data': timeline_data,
        'subscriber_data': subscription_data,
        'update_token': update_token,
        'heatmap': heatmap,
        })
Esempio n. 7
0
def podcast(request, podcast):

    if not check_publisher_permission(request.user, podcast):
        return HttpResponseForbidden()

    timeline_data = listener_data([podcast])
    subscription_data = subscriber_data([podcast])[-20:]

    update_token = request.user.profile.get_token('publisher_update_token')

    try:
        pubsubscription = HubSubscription.objects.get(topic_url=podcast.url)
    except HubSubscription.DoesNotExist:
        pubsubscription = None

    MAX_UPDATE_RESULTS = 10

    update_results = PodcastUpdateResult.objects.filter(podcast=podcast)
    update_results = update_results[:MAX_UPDATE_RESULTS]

    site = RequestSite(request)
    feedurl_quoted = urllib.parse.quote(podcast.url.encode('ascii'))

    return render(
        request,
        'publisher/podcast.html',
        {
            'site': site,
            'podcast': podcast,
            'group': podcast.group,
            'form': None,
            'timeline_data': timeline_data,
            'subscriber_data': subscription_data,
            'update_token': update_token,
            'feedurl_quoted': feedurl_quoted,
            'pubsubscription': pubsubscription,
            'update_results': update_results,
        },
    )