Beispiel #1
0
def search_by_director(_, resp: responder.Response, director_name: str):
    movies = db.search_director(director_name)
    limited = len(movies) > response_count_max
    if limited:
        movies = movies[:response_count_max]
    movie_dicts = [db.movie_to_dict(m) for m in movies]
    resp.media = {
        "keyword": director_name,
        "hits": movie_dicts,
        "truncated_results": limited,
    }
Beispiel #2
0
def search_director(_, resp, director_name: str):
    movies = db.search_director(director_name)
    print("Searching for director {}, {} results".format(director_name, len(movies)))

    limited = len(movies) > response_count_max
    if limited:
        movies = movies[:response_count_max]

    movies_dicts = [
        db.movie_to_dict(m)
        for m in movies
    ]

    resp.media = {'keyword': director_name, 'hits': movies_dicts, 'truncated_results': limited}
def search_by_director(_, resp: responder.Response, director_name: str):
    movies = db.search_director(director_name)
    print("Searching for movie by director: {}".format(director_name))

    limited = len(movies) > response_count_max
    if limited:
        movies = movies[:10]

    movie_dicts = [
        db.movie_to_dict(m)
        for m in movies
    ]

    resp.media = {'keyword': director_name, 'hits': movie_dicts, 'truncated_results': limited}
def search_by_director(_, resp: responder.Response, director_name: str):
    movies = db.search_director(director_name)
    print(f"Searching for movies by director_name: {director_name}")

    limited = len(movies) > RESPONSE_COUNT_MAX
    if limited:
        movies = movies[:10]

    movie_dicts = [db.movie_to_dict(m) for m in movies]

    resp.media = {
        "keyword": director_name,
        "hits": movie_dicts,
        "truncated_results": limited
    }
Beispiel #5
0
def search_by_director(
    _,
    response: responder.Response,
    director_name: str,
) -> None:

    movies = db.search_director(director_name)

    # Limit returns. Why ever... The limit seems arbitrary.
    max_returns = 10
    if len(movies) > max_returns:
        movies = movies[:max_returns]

    movie_dicts = [db.movie_to_dict(movie) for movie in movies]

    response.media = {
        "Searched": director_name,
        "Found": len(movie_dicts),
        "Results": movie_dicts,
    }