def available_movies(self): global root5 global root6 global root7 try: if root6: root6.destroy() except: try: if root5: root5.destroy() except: pass root7 = Tk() root7.title("AVAILABLE MOVIES") file = open('dsap_92det.txt', "r") file_text = file.readlines() file.close() file_r_text = liex.cleaner(file_text) la1 = Label(root7, text="Following " + str(len(file_r_text)) + " movies we have -->", fg="yellow") la1.grid(row=0) count = 1 count2 = 0 for line in file_r_text: la2 = Label(root7, text=str(count) + '.)\t' + line[1] + '\t\t' + 'Genre: ' + line[2], anchor=W) count += 1 la2.grid(row=1 + count2) count2 += 1 root.mainloop()
def remove_code(self): title = e6.get() answer = tkinter.messagebox.askquestion("Admin Access", "Delete " + title) if answer == "yes": database = open("dsap_92det.txt", "r") lines = database.readlines() o_lines = lines # lines is not a nested list so no trouble database.close() database = open('dsap_92det.txt', "w") lines = liex.cleaner(lines) for x in range(len(lines)): if title != lines[x][1]: database.write(str(o_lines[x])) else: tkinter.messagebox.showinfo( "Deleted Successfuly", title + " is deleted successfully") break else: tkinter.messagebox.showinfo("Film Not Present", title + " is not present") database.close() root2.destroy()
def see(self): global client_id global client_pass title = e1.get() root2.geometry("450x250") file = open('dsap_92det.txt', "r") file_text = file.readlines() file.close() file_r_text = liex.cleaner(file_text) for line in file_r_text: if line[1] == title: file = open( "clients/" + client_id + '_' + client_pass + '.txt', "a+") file.write(time.ctime() + '\t ' + title + '\n') collect = open("collective.txt", "a+") collect.write(time.ctime() + '\t ' + title + '\n') collect.close() file.close() webbrowser.open(line[0]) root2.destroy() break else: tkinter.messagebox.showinfo("Film Not Present", title + " is not present") root2.destroy() watch(self)
def available_movies(): #first in first out file = open(server_id + '_' + server_pass + '.txt', "r") file_text = file.readlines() file.close() file_r_text = liex.cleaner(file_text) print("Following " + str(len(file_r_text)) + " movies we have -->") count = 1 for line in file_r_text: print(str(count) + '.)\t' + line[1] + '\t' + 'Genre: ' + line[2]) count += 1 print()
def search(): m_name = input('Give name of film: ') file = open(server_id + '_' + server_pass + '.txt', "r") file_text = file.readlines() file.close() file_r_text = liex.cleaner(file_text) for x in file_r_text: if x[1] == m_name: print("Yes, we have " + m_name) break else: print("Sorry, We don't have this film.") print()
def remove(): title = input("Give title of movie to be deleted: ") database = open(server_id + '_' + server_pass + '.txt', "r") lines = database.readlines() o_lines = lines # lines is not a nested list so no trouble database.close() database = open(server_id + '_' + server_pass + '.txt', "w") lines = liex.cleaner(lines) #print(lines) for x in range(len(lines)): #print(title, line[1]) if title != lines[x][1]: database.write(str(o_lines[x])) else: print(title + " is successfully removed.\n") database.close()
def watch(): title = input("Give title of movie to watch: ") file = open(server_id + '_' + server_pass + '.txt', "r") file_text = file.readlines() file.close() file_r_text = liex.cleaner(file_text) for line in file_r_text: if line[1] == title: print("Now watching " + title + ' at ' + time.ctime()) file = open("clients/" + client_id + '_' + client_pass + '.txt', "a+") file.write(time.ctime() + '\t ' + title + '\n') collect = open(collective, "a+") collect.write(time.ctime() + '\t ' + title + '\n') collect.close() file.close() webbrowser.open(line[0]) print() break else: print("This film is currently unavilable.\n")