def search_parameter(): try: title = (title_entry.get(), "title") id = (id_entry.get(), "id") genre = (genre_entry.get(), "genre") ans = backend.get_movie(title, id, genre) update_listbox(ans) except Exception: print(Exception.message)
def on_click(event): selection = movie_listbox.curselection()[0] global selected_movie selected_movie = movie_listbox.get(selection) selected_movie = backend.get_movie([selected_movie, "title"])[0] # clean Entry id_entry.delete(0, END) title_entry.delete(0, END) genre_entry.delete(0, END) id_entry.insert(0, selected_movie[0]) title_entry.insert(0, selected_movie[1]) genre_entry.insert(0, selected_movie[2])
def user_recommendation(get_data): current_user = get_data("userid") k = int(get_data("k")) data = get_all_ratings() users_id = set([row[0] for row in data if row[0] != current_user]) k_users = [ row[0] for row in sorted([(user_id, user_sim(current_user, user_id, data)) for user_id in users_id], key=lambda o: o[1], reverse=True)[:k] ] movies_id = [] for user_id in k_users: for movie_id in sorted_user_ratings(user_id, data): if movie_id not in movies_id: movies_id.append(movie_id) break return jsonify([get_movie(movie_id)[1] for movie_id in movies_id])
def view_all(): listbox.delete(0, END) for movie in DB.get_movie(""): listbox.insert("end", ', '.join(movie))
def search_entry(): listbox.delete(0, END) for movie in DB.get_movie(id_entry.get(), title_entry.get(), genre_entry.get()): listbox.insert("end", ', '.join(movie))