Esempio n. 1
0
def details(request):
    """Details Page."""
    showid = request.GET.get('show', False)
    if not showid or not showid.isdigit():
        return HttpResponseRedirect("/")
    data = shows.get_show_info(showid)
    if 'unfollow' in request.GET:
        showid = request.GET['unfollow']
        shows.unfollow_show(showid, request.user)
    elif 'follow' in request.GET:
        showid = request.GET['follow']
        shows.follow_show(showid, request.user)
    data['following'] = shows.user_is_following(showid, request.user)
    if 'season' in request.GET:
        season = request.GET['season']
        episode = request.GET['episode']
        if not season.isdigit() or not episode.isdigit():
            season = 1
            episode = 1
        info = shows.get_episodes_for_season(showid, season, episode)
        data['episode_info'] = info
    else:
        seasons = shows.get_seasons(showid, request.user)
        data['seasons'] = seasons
    most_rated = shows.get_most_rated_shows(request.user)
    data['recommended'] = most_rated
    return render_response(request, 'details.html', data)
Esempio n. 2
0
def details(request):
    """Details Page."""
    showid = request.GET.get('show', False)
    if not showid or not showid.isdigit():
        return HttpResponseRedirect("/")
    data = shows.get_show_info(showid)
    if 'unfollow' in request.GET:
        showid = request.GET['unfollow']
        shows.unfollow_show(showid, request.user)
    elif 'follow' in request.GET:
        showid = request.GET['follow']
        shows.follow_show(showid, request.user)
    data['following'] = shows.user_is_following(showid, request.user)
    if 'season' in request.GET:
        season = request.GET['season']
        episode = request.GET['episode']
        if not season.isdigit() or not episode.isdigit():
            season = 1
            episode = 1
        info = shows.get_episodes_for_season(showid, season, episode)
        data['episode_info'] = info
    else:
        seasons = shows.get_seasons(showid, request.user)
        data['seasons'] = seasons
    most_rated = shows.get_most_rated_shows(request.user)
    data['recommended'] = most_rated
    return render_response(request, 'details.html', data)
Esempio n. 3
0
def get_details(request):
    data = {}
    user = _validate_token(request)
    if user:
        showid = request.GET.get('showid', '')
        data = shows.get_show_info(showid, client=True)
        data['following'] = shows.user_is_following(showid, user)
        seasons = shows.get_seasons_client(showid, user)
        data['seasons'] = seasons

    data = simplejson.dumps(data)
    return HttpResponse(data, mimetype='application/json')
Esempio n. 4
0
def get_details(request):
    data = {}
    user = _validate_token(request)
    if user:
        showid = request.GET.get('showid', '')
        data = shows.get_show_info(showid, client=True)
        data['following'] = shows.user_is_following(showid, user)
        seasons = shows.get_seasons_client(showid, user)
        data['seasons'] = seasons

    data = simplejson.dumps(data)
    return HttpResponse(data, mimetype='application/json')