示例#1
0
 def show_all_my_movies_with_cast(self):
     print_with_nl("This is my database of movies with cast:")
     time.sleep(1)
     print("(This will take a moment...)")
     time.sleep(2)
     for movie_title in self.my_movies.list_of_titles:
         this_movie = self.my_movies.database[movie_title]
         line_printer.line()
         time.sleep(0.5)
         print(movie_title, f'({this_movie.get_year_of_production()})')
         this_movie.show_cast()
示例#2
0
 def add_cast_to_movie(self):
     print_with_nl(
         "Warning! Actors and movies that you enter here as cast must already exist in database.\n"
     )
     movie_title = look_for(
         "title of movie", self.my_movies.list_of_titles, "no movie titled",
         "correct title of movie.",
         "Press 1 to return to menu and add new movie to database.")
     cast = []
     while movie_title:
         actor_name = look_for(
             "name of actor/actress", self.my_actors.list_of_actors,
             "no such person", "correct name of actor/actress.",
             "Press 1 to return to menu and add new actor/actress to database."
         )
         if actor_name in [
                 actor.get_name() for actor in
                 self.my_movies.database[movie_title].cast.cast.keys()
         ]:
             print_with_nl(
                 f"{actor_name} has been already casted in {movie_title}!")
             continue
         role = get_str_from_user(
             f"Enter the role of {actor_name} in \"{movie_title}\".\n",
             duplicate=True)
         cast.append(actor_name)
         cast.append(string.capwords(role))
         if input("Do you want to add another role? Press y for yes.\n"
                  ) not in ['y', 'Y']:
             break
     if cast:
         print(movie_title)
         for i in range(0, len(cast), 2):
             print(cast[i], 'as', cast[i + 1])
     validation = input(
         "Are you sure you want to add such data to cast database?\ny for yes\nn for no\nc for correct data\n"
     )
     if validation == "y":
         add_to_txt_database('cast', [movie_title])
         for i in range(0, len(cast), 2):
             add_to_txt_database('cast', [f"{cast[i]} as {cast[i + 1]}"],
                                 without_new_line=True)
             self.my_movies.database[movie_title].add_cast(
                 self.my_actors.database[cast[i]], cast[i + 1])
     elif validation == "c":
         self.add_cast_to_movie()
     else:
         self.intro()
示例#3
0
def look_for(search, database, text1, text2, text3="(Press 1 to quit this option)"):
    name = input(f"Please enter {search} you are looking for:\n").capitalize()
    temp = 0
    while name not in database:
        for data in database:
            if name.lower() == data.lower():
                return data
            if re.search(name.lower(), data.lower()):
                temp += 1
                if temp == 1:
                    print_with_nl("Here are some suggestions:")
                print(data)
        if name == '1':
            return
        line()
        name = input(
            f"There is {text1} '{capwords(name)}' in my database."
            f"\nPlease enter {text2}\n{text3}\n")
    line()
    return name
示例#4
0
 def show_actor_filmography(self):
     actor_name = look_for("name of actor/actress",
                           self.my_actors.list_of_actors, "no such person",
                           "correct or another name of actor/actress.")
     print_with_nl(self.my_actors.database[actor_name].introduce_myself())
     return self.my_actors.database[actor_name].show_filmography()
示例#5
0
 def show_all_my_actors(self):
     print_with_nl("This is content of MyActorsDatabase:")
     return self.my_actors.print_database_content()
示例#6
0
 def show_all_my_movies(self):
     print_with_nl("This is content of MyMovieDatabase:")
     return self.my_movies.print_database_content()