def get_all_movie(condition, repo: AbstractRepository):
    movies = []

    if condition[0] != 'All' and condition[1] != 'All':
        movies_genre = repo.get_movies_by_genre(condition[0])
        movies_year = repo.get_movies_by_year(condition[1])
        if len(movies_year) < len(movies_genre):
            for movie in movies_year:
                if movie in movies_genre:
                    movies.append(movie)
        else:
            for movie in movies_genre:
                if movie in movies_year:
                    movies.append(movie)

    elif condition == ['All', 'All']:
        for rank in range(1, repo.get_number_of_movies() + 1):
            movies.append(repo.get_movie(int(rank)))

    else:
        index = condition.index('All')
        if index == 0:
            movies = repo.get_movies_by_year(condition[1])
        else:
            movies = repo.get_movies_by_genre(condition[0])

    if movies == []:
        return 'None'

    return movies
def get_10_movie(condition, repo: AbstractRepository):
    movies = []
    #generate 10 random movies
    if condition == 'random':
        random_rank_list = random.sample(
            range(12,
                  repo.get_number_of_movies() + 1), 10)
        for rank in random_rank_list:
            movies.append(repo.get_movie(rank))

    #all genres
    else:
        all_genre_movies = []
        for genre in condition:
            all_genre_movies += [
                movie for movie in repo.get_movies_by_genre(genre.genre_name)
                if movie not in all_genre_movies
            ]
        if len(all_genre_movies) >= 10:
            random_index_list = random.sample(range(len(all_genre_movies)), 10)
        else:  #less than 10 movies among all the genres
            random_index_list = random.sample(range(len(all_genre_movies)),
                                              len(all_genre_movies))
        for index in random_index_list:
            movies.append(all_genre_movies[index])

    if movies is []:
        raise NonExistentMovieException

    return movies