From 734b48fa6e7bc4ac70eaa508f738e7d5eb754357 Mon Sep 17 00:00:00 2001 From: alexalmeida2001 <47391414+alexalmeida2001@users.noreply.github.com> Date: Wed, 9 Dec 2020 10:49:37 +0000 Subject: [PATCH] Create main_CODIGO_TOTAL --- main_CODIGO_TOTAL | 233 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 main_CODIGO_TOTAL diff --git a/main_CODIGO_TOTAL b/main_CODIGO_TOTAL new file mode 100644 index 0000000..11e8aa8 --- /dev/null +++ b/main_CODIGO_TOTAL @@ -0,0 +1,233 @@ +import database + + +def menu(): + menu_interface = """ + -- Netflox -- + 1) Sign Up + 2) Log in + 0) Exit + Your Selection: """ + + while (user_input := input(menu_interface)) != '0': + + if user_input == '1': + print("\n\tSign up") + name = input("\tEnter your name: ") + email = input("\tEnter your e-mail: ") + password = input("\tEnter your password: ") + database.create_user(name, email, password) + + elif user_input == '2': + print("\n\tLog in") + email = input("\tEnter your e-mail: ") + password = input("\tEnter your password: ") + user = database.log_in(email, password) + if user == -1: + return user # admin + elif user == 1: + return user # client + + else: + print("Invalid input, please try again") + + +def client(): + client_interface = """ + 1) Search products + 2) View all + 3) View my products + 4) My history + 5) Messages + 0) Exit + Your Selection: """ + while (client_input := input(client_interface)) != '0': + if client_input == '1': + + search_interface = """Search by + 1) Name + 2) Actor + 3) Director + 4) Type + 0) Exit + Your Selection: """ + + while (search_input := input(search_interface)) != '0': + if search_input == '1': + name = input("Insert movie name: ") + database.findby_name(name) + if search_input == '2': + actor = input("Insert actor name: ") + database.findby_actor(actor) + + if search_input == '4': + type = input("Insert 'movie' or 'series': ") + database.findby_type(type) + + if search_input == '3': + director = input("Insert Director name: ") + database.findby_director(director) + + if search_input == '4': + type = input("Insert 'movie' or 'series': ") + database.findby_type(type) + + + if client_input == '2': + database.view_allmovies() + client_input_view = input("Select a movie or\nOrder by: 1.Title 2. Director 3.Date of release 4.Imdb rating 0.Go back\n") + if client_input_view == '1': + print("ordered by title:\n") + database.view_allmovies_ordertitle() + + if client_input_view == '2': + print("ordered by Director:\n") + database.view_allmovies_orderdirector() + if client_input_view == '3': + print("ordered by Date of Realease:\n") + database.view_allmovies_orderdate() + if client_input_view == '4': + print("ordered by Imdb rating:\n") + database.view_allmovies_orderimdb() + + if (client_input_view != '0') and (client_input_view != '1') and (client_input_view != '2') and (client_input_view != '3') and (client_input_view != '4') : + print("id name, actorid, director, imdbrating, genre, price, year, timeavaible, type") + moviename=database.view_movieinfo(client_input_view) + if moviename==0: + break + client_input_view_buy =input ("press 1 to buy press 0 to leave\n") + if client_input_view_buy == '1': + client_input_view_buy=input("are you sure you want to buy?\n(press 1 yes press 0 no)") + print("\no seu saldo é :") + saldo=database.view_saldo(USERID) + print(" o item custa:") + custo=database.view_custo(client_input_view) + client_input_view_buy = input("press 1 to confirm press 0 to leave\n") + if client_input_view_buy == '1': + if(custo