예제 #1
0
def overview():
    log_event(request, "ViewFrontPage")
    return render_template('index.html',
                           base_url=app.config['BASE_URL'],
                           fb_pixel=create_fb_pixel()['code'],
                           ga_enabled=app.config['GA_ENABLED'],
                           ga_tracker_id=app.config['GA_TRACKER_ID'])
예제 #2
0
def discover_shows():
    result = []
    log_event(request, "ViewShowsOverview")

    for epguides_name in list_all_epguides_keys_redis():
        try:
            show = {
                'episodes':
                "{0}show/{1}/".format(app.config['BASE_URL'], epguides_name),
                'first_episode':
                "{0}show/{1}/first/".format(app.config['BASE_URL'],
                                            epguides_name),
                'next_episode':
                "{0}show/{1}/next/".format(app.config['BASE_URL'],
                                           epguides_name),
                'last_episode':
                "{0}show/{1}/last/".format(app.config['BASE_URL'],
                                           epguides_name),
                'epguides_url':
                "http://www.epguides.com/{0}".format(epguides_name)
            }
            result.append(show)
        except EpisodeNotFoundException:
            continue

    return json_response(result)
예제 #3
0
def view_show(show):
    log_event(request, "ViewShow")
    add_epguides_key_to_redis(show)
    try:
        return json_response(get_show_by_key(show).get_show_data())
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)
예제 #4
0
def last(show):
    log_event(request, "ViewShowLastEpisode")
    add_epguides_key_to_redis(show)
    try:
        return json_response({'episode': get_show_by_key(show).last_episode()})
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)
예제 #5
0
def next_from_given_episode(show, season, episode):
    log_event(request, "ViewNextFromGivenEpisode")
    add_epguides_key_to_redis(show)
    try:
        show = get_show_by_key(show)
        return json_response(
            {'episode': show.get_episode(int(season), int(episode)).next()})
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)
예제 #6
0
def released(show, season, episode):
    log_event(request, "ViewReleased")
    add_epguides_key_to_redis(show)
    try:
        show = get_show_by_key(show)
        return json_response(
            {'status': show.episode_released(int(season), int(episode))})
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)
예제 #7
0
def episode(show, season, episode):
    log_event(request, "ViewEpisode")
    add_epguides_key_to_redis(show)
    try:
        return json_response({
            'episode':
            get_show_by_key(show).get_episode(int(season), int(episode))
        })
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)
예제 #8
0
def next_released_from_given_episode(show, season, episode):
    log_event(request, "ViewNextReleasedFromGivenEpisode")
    add_epguides_key_to_redis(show)
    try:
        show = get_show_by_key(show)
        next_episode = show.get_episode(season, episode).next()
        if not next_episode:
            raise EpisodeNotFoundException
        return json_response({'status': next_episode.released()})
    except EpisodeNotFoundException:
        return json_response({'error': 'Show not found'}, 404)
    except SeasonNotFoundException:
        return json_response({'error': 'Season not found'}, 404)