def setUp(self) -> None: """Setup a temporary database""" conn = sqlite3.connect("test_database.sqlite") cursor = conn.cursor() # drop table if exists cursor.execute("""DROP TABLE IF EXISTS movies""") # create a table cursor.execute( """CREATE TABLE MOVIES ([ID] INTEGER PRIMARY KEY,[TITLE] text, [YEAR] integer, [RUNTIME] text, [GENRE] text, [DIRECTOR] text, "ACTORS" text, [WRITER] text, [LANGUAGE] text, [COUNTRY] text, [AWARDS] text, [IMDb_Rating] float, [IMDb_votes] integer, [BOX_OFFICE] integer )""") # add 2 movie titles cursor.execute( """INSERT INTO MOVIES (TITLE, YEAR, RUNTIME, GENRE, DIRECTOR, ACTORS, WRITER, LANGUAGE, COUNTRY, AWARDS, IMDb_Rating, IMDb_votes, BOX_OFFICE) VALUES ('Gladiator', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)""") cursor.execute( """INSERT INTO MOVIES (TITLE, YEAR, RUNTIME, GENRE, DIRECTOR, ACTORS, WRITER, LANGUAGE, COUNTRY, AWARDS, IMDb_Rating, IMDb_votes, BOX_OFFICE) VALUES ('Se7en', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)""") # save data to database conn.commit() # create instance self.movie_test = movies.Movies("test_database.sqlite") # complete data about 2 movies self.movie_test.complete_all()
def display_trailer_webpage(): """ Display the final trailer webpage. Reads the JSON file with old and new (if added) movies and prepares the webpage with trailers of all the movies. """ for i in range(len(movies_data['movies'])): name = movies_data['movies'][i]['movie_title'] movie_title = name movie_storyline = movies_data['movies'][i]['movie_storyline'] poster_image = movies_data['movies'][i]['poster_image'] trailer_youtube = movies_data['movies'][i]['trailer_youtube'] # adding object each time to the list of movie objects movies_list.append(movies.Movies(movie_title, movie_storyline, poster_image, trailer_youtube)) # using fresh_tomatoes.py file to finally open the webpage with the movie object items ft.open_movies_page(movies_list)
def __init__(self, db): self.db = db self.cursor = db.cursor() self.movies = movies.Movies(db) self.projections = projections.Projections(db) self.reservations = reservations.Reservations(db)
import movies """ Here is generated the dialogue which will use alexa to response """ DB = movies.Movies() def get_welcome_response(): session_attributes = {} card_title = "Welcome to Best Movies" speech_output = "Welcome to Best Movies, you can find movies just said as follow: " \ "search movies between nineteen sixty five and nineteen eighty five. Or " \ "search movies for nineteen eighty five. What do you want to search" reprompt_text = speech_output should_end_session = False return build_response( session_attributes, build_speechlet_response(card_title, speech_output, reprompt_text, should_end_session)) def get_help_response(): """ If we wanted to initialize the session to have some attributes we could add those here """ session_attributes = {} card_title = "Best Movies Help" speech_output = "In Best Movies You will find movies from 1930 and onwards. " \