Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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])
Exemplo n.º 3
0
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])
Exemplo n.º 4
0
def view_all():
    listbox.delete(0, END)
    for movie in DB.get_movie(""):
        listbox.insert("end", ', '.join(movie))
Exemplo n.º 5
0
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))