def get_movie_objs(data_dict, home, user_start, user_end, travel_mode='driving'): movies = set([]) theatre_count = 0 for theatre in data_dict.keys(): #if theatre_count < theatre_max: # theatre_count += 1 address = data_dict[theatre]['address'] (lat, lng) = get_coordinates(address) travel_time = get_distance(home.lat, home.lng, lat, lng, travel_mode) if user_start + travel_time < user_end: for name in data_dict[theatre]['movies'].keys(): run_time = data_dict[theatre]['movies'][name]['run_time'] for time in data_dict[theatre]['movies'][name]['start_times']: if run_time != None: if time > user_start and time + run_time < user_end: movie_obj = movie(name, time, run_time, theatre, lat, lng, travel_time) movies.add(movie_obj) return movies
def get_movie_objs(data_dict, home, user_start, user_end, travel_mode = 'driving'): movies = set([]) theatre_count = 0 for theatre in data_dict.keys(): #if theatre_count < theatre_max: # theatre_count += 1 address = data_dict[theatre]['address'] (lat,lng) = get_coordinates(address) travel_time = get_distance(home.lat, home.lng,lat, lng, travel_mode) if user_start + travel_time < user_end: for name in data_dict[theatre]['movies'].keys(): run_time = data_dict[theatre]['movies'][name]['run_time'] for time in data_dict[theatre]['movies'][name]['start_times']: if run_time != None: if time > user_start and time + run_time < user_end: movie_obj = movie(name, time, run_time, theatre, lat, lng, travel_time) movies.add(movie_obj) return movies