def show_movies(): # creating movie instances jungle_book = media.Movie("Jungle Book", "http://cdn.collider.com/wp-content/uploads/2015/08/jungle-book-poster-hi-res.jpeg", # NOQA "https://youtu.be/5mkm22yO-bs") # NOQA storks = media.Movie("Storks", "http://www.getmovieposter.com/wp-content/uploads/getmovieposter_storks_1.jpg", # NOQA "https://www.youtube.com/watch?v=B1UE7hMblmQ") # NOQA zootopia = media.Movie("Zootopia", "http://cdn.collider.com/wp-content/uploads/2015/12/zootopia-movie-poster.jpg", # NOQA "https://www.youtube.com/watch?v=WWFB-zrxn7o") # NOQA finding_dory = media.Movie("Finding Dory", "http://www.everythingpixar.com/uploads/3/8/2/4/38249737/9213755_orig.jpg", # NOQA "https://www.youtube.com/watch?v=NQu-153MnGQ") # NOQA lion_king = media.Movie("The Lion King", "http://mpspg.com/images/lion-king-movie-cover-i11.jpg", # NOQA "https://www.youtube.com/watch?v=GaJWzJfoXlE") # NOQA frozen = media.Movie("Frozen", "https://walter.trakt.us/images/movies/000/077/349/posters/original/9d1a3cdcf2.jpg", # NOQA "https://www.youtube.com/watch?v=R-cdIvgBCWY") # NOQA movies = [jungle_book, storks, zootopia, finding_dory, lion_king, frozen] fresh_tomatoes.open_movies_page(movies) return
def main(): """ 1. Retrieves a list of Movie-objects . 2. Calls render function with that list. """ movies = get_objectlist(movie_data) fresh_tomatoes.open_movies_page(movies)
def main(): # create Movies # for each movie, specify title, posterUrl, movieUrl movie1 = media.Movie( 'Lord of the Rings: The Fellowship of the Ring', "http://i.ebayimg.com/images/i/161917668516-0-1/s-l1000.jpg", "https://www.youtube.com/watch?v=Pki6jbSbXIY") movie2 = media.Movie( 'The Matrix', "http://moviefiles.alphacoders.com/288/poster-28.jpg", "https://www.youtube.com/watch?v=m8e-FF8MsqU") movie3 = media.Movie( 'Rigoletto', "http://ecx.images-amazon.com/images/I/51wIO3d%2BeFL.jpg", "https://www.youtube.com/watch?v=zLB78OYKNqE") # createMovieList movieList = [] movieList.append(movie1) movieList.append(movie2) movieList.append(movie3) # render entertainment center page fresh_tomatoes.open_movies_page(movieList)
def main(): """ This is the first function that is executed. It constructs various movies using the Movie class found in media. It then organizes all the movies into a list, and then shows them in a web page, using fresh tomatoes """ shawshank_redemption = media.Movie( "The Shawshank Redemption", ("Two imprisoned men bond over a number of " "years, finding solace and eventual redemption through acts of common " "decency."), "http://goo.gl/vSx29c", "https://www.youtube.com/watch?v=evINraaYqxM", ["Tim Robbins", "Morgin Freeman", "Bob Gunton"], 9.3 ) dark_knight = media.Movie( "The Dark Knight", ("When the menace known as the Joker wreaks havoc " "and chaos on the people of Gotham, the caped crusader must come to " "terms with one of the greatest psychological tests of his ability to " "fight injustice."), "http://goo.gl/1MRMQe", "https://www.youtube.com/watch?v=EXeTwQWrcwY", ["Christopher Bale", "Heath Ledger", "Aaron Eckhart"], 9.0 ) return_of_the_king = media.Movie( "The Lord of the Rings: The Return of the King", ("Gandalf and Aragorn " "lead the World of Men against Sauron's army to draw his gaze from " "Frodo and Sam as they approach Mount Doom with the One Ring."), "http://goo.gl/tLHu3K", "https://www.youtube.com/watch?v=7JgpXiMcmJk", ["Elijah Wood", "Viggo Mortensen", "Ian McKellen"], 8.9 ) fight_club = media.Movie( "Fight Club", ("An insomniac office worker, looking for a way to " "change his life, crosses paths with a devil-may-care soap maker, " "forming an underground fight club that evolves into something much, " "much more..."), "http://goo.gl/G4gDR7", "https://www.youtube.com/watch?v=SUXWAEX2jlg", ["Brad Pitt", "Edward Norton", "Helena Bonham Carter"], 8.9 ) inception = media.Movie( "Inception", ("A thief who steals corporate secrets through use of " "dream-sharing technology is given the inverse task of planting an " "idea into the mind of a CEO."), "http://goo.gl/xUE3lN", "https://www.youtube.com/watch?v=8hP9D6kZseM", ["Leonardo DiCaprio", "Jospeh Gordon-Levitt", "Ellen Page"], 8.8 ) the_matrix = media.Movie( "The Matrix", ("A computer hacker learns from mysterious rebels about " "the true nature of his reality and his role in the war against its " "controllers."), "http://goo.gl/nUOX8T", "https://www.youtube.com/watch?v=m8e-FF8MsqU", ["Keanu Reeves", "Laurence Fishburne", "Carrie-Anne Moss"], 8.7 ) movies = [shawshank_redemption, dark_knight, return_of_the_king, fight_club, inception, the_matrix] fresh_tomatoes.open_movies_page(movies)
def main(): # get help and setup to accept command line arguments parser = argparse.ArgumentParser(description="Generate Bootstrap movie site.") parser.add_argument( "PATH", metavar="PATH", nargs="?", type=str, default="movies/", help="Location of the folder containing movie text files. \n (default: movies/)", ) # path containing movies data args = parser.parse_args() path = args.PATH # container for movie objects movies = [] # find all the files (we assume that the folder contains nothing but readable text files containing movie data) for _, _, files in os.walk(path): for file in files: with open(path + file) as f: lines = f.read().split("\n") movies.append( Movie( lines[NAME], lines[IMG_URL], lines[YOUTUBE_TRAILER], lines[SUMMARY], lines[DIRECTOR], *lines[DIRECTOR + 1 :] ) ) fresh_tomatoes.open_movies_page(movies)
def launch(): # Creates list of movie instances by looping through my_list and using # Movie constructor to create Movie instance movies = [Movie(**m) for m in my_list] # Insert list into open_movies_page function from fresh_tomatoes to # launch page open_movies_page(movies)
def main(): # add movies' fields interstellar = Movie.Movie("Interstellar", "http://www.hdwallpapers.in/download/" "interstellar-3840x2160.jpg", "https://www.youtube.com/watch?v=0vxOhd4qlnA") inception = Movie.Movie("Inception", "https://upload.wikimedia.org/" "wikipedia/en/1/18/Inception_OST.jpg", "https://www.youtube.com/watch?v=8hP9D6kZseM") shutter_island = Movie.Movie("Shutter Island", "https://d.ibtimes.co.uk/en/full/1396267/" "shutter-island-movie-be-made-into-tv-series" ".jpg" "https://www.youtube.com/watch?v=5iaYLCiq5RM") enemy_at_the_gate = Movie.Movie("Enemy at the Gate", "http://www.miniih.com/miniiblog/mergen/" "files/Enemy%20At%20The%20Gates.jpg", "www.google.com") dark_night_rise = Movie.Movie("Dark Night Rise", "http://paulmmartinblog.files.wordpress.com/" "2011/07/the_dark_knight_poster.jpg", "https://www.youtube.com/" "watch?v=EXeTwQWrcwY") xmen = Movie.Movie("X-Men First Class", "http://vignette2.wikia.nocookie.net/marvelmovies/" "images/" "6/64/Pakorn-x-men-first-class- " "25197968-2560-1810.jpg/revision/" "latest?cb=20120921143114", "www.google.com") # Add movies to the list movies = [interstellar, inception, shutter_island, enemy_at_the_gate, dark_night_rise, xmen] # Load the main page fresh_tomatoes.open_movies_page(movies)
def main(): man_of_steel = Movie("Man of Steel", "http://upload.wikimedia.org/wikipedia/en/8/85/ManofSteelFinalPoster.jpg", "https://www.youtube.com/watch?v=T6DJcgm3wNY") school_of_rock = Movie("School of Rock", "http://upload.wikimedia.org/wikipedia/en/1/11/School_of_Rock_Poster.jpg", "https://www.youtube.com/watch?v=5afGGGsxvEA") spiderman = Movie("Spiderman", "https://image.tmdb.org/t/p/original/jz6NCADCgj4dWU8RM81Xvrokey4.jpg", "https://www.youtube.com/watch?v=EQdOOTQnuvk") avengers = Movie("The Avengers", "http://pleasantvalleylibrary.org/files/2015/02/theavengers001.jpg", "https://www.youtube.com/watch?v=eOrNdBpGMv8") open_movies_page([school_of_rock, spiderman, man_of_steel, avengers])
def main(): # Assemble list of Bond movies bond_movies = [ Movie( "Spectre", "https://upload.wikimedia.org/wikipedia/en/thumb/c/c3/Spectre_poster.jpg/220px-Spectre_poster.jpg", # NOQA "https://www.youtube.com/watch?v=z4UDNzXD3qA"), Movie( "Skyfall", "https://upload.wikimedia.org/wikipedia/en/thumb/a/a7/Skyfall_poster.jpg/220px-Skyfall_poster.jpg", # NOQA "hhttps://www.youtube.com/watch?v=6kw1UVovByw"), Movie( "You Only Live Twice", "https://upload.wikimedia.org/wikipedia/en/thumb/3/32/You_Only_Live_Twice_-_UK_cinema_poster.jpg/220px-You_Only_Live_Twice_-_UK_cinema_poster.jpg", # NOQA "https://www.youtube.com/watch?v=-gGiYrS2Y1k"), Movie( "Moonraker", "https://upload.wikimedia.org/wikipedia/en/thumb/6/66/Moonraker_%28UK_cinema_poster%29.jpg/220px-Moonraker_%28UK_cinema_poster%29.jpg", # NOQA "https://www.youtube.com/watch?v=KFOOjYU16KE"), Movie( "Octopussy", "https://upload.wikimedia.org/wikipedia/en/thumb/b/b2/Octopussy_-_UK_cinema_poster.jpg/220px-Octopussy_-_UK_cinema_poster.jpg", # NOQA "https://www.youtube.com/watch?v=IwHbCvXMbS8"), Movie( "Goldeneye", "https://upload.wikimedia.org/wikipedia/en/thumb/2/24/GoldenEye_-_UK_cinema_poster.jpg/220px-GoldenEye_-_UK_cinema_poster.jpg", # NOQA "https://www.youtube.com/watch?v=HHFXthl5IJo")] # Launch web browser with list of movies open_movies_page(bond_movies)
def show_movies(): jungle_book = media.Movie("Jungle Book", "http://cdn.collider.com/wp-content/uploads/2015/08/jungle-book-poster-hi-res.jpeg", "https://youtu.be/5mkm22yO-bs") minions = media.Movie("Minions", "http://i2.wp.com/bitcast-a-sm.bitgravity.com/slashfilm/wp/wp-content/images/Minions-poster1.jpg", "https://youtu.be/P9-FCC6I7u0") finding_dory = media.Movie("Finding Dory", "http://www.everythingpixar.com/uploads/3/8/2/4/38249737/9213755_orig.jpg", "https://www.youtube.com/watch?v=NQu-153MnGQ") zootopia = media.Movie("Zootopia", "http://cdn.collider.com/wp-content/uploads/2015/12/zootopia-movie-poster.jpg", "https://www.youtube.com/watch?v=WWFB-zrxn7o") frozen = media.Movie("Frozen", "https://walter.trakt.us/images/movies/000/077/349/posters/original/9d1a3cdcf2.jpg", "https://www.youtube.com/watch?v=R-cdIvgBCWY") lion_king = media.Movie("The Lion King", "http://mpspg.com/images/lion-king-movie-cover-i11.jpg", "https://www.youtube.com/watch?v=GaJWzJfoXlE") movies = [jungle_book, minions,finding_dory, zootopia, frozen, lion_king] fresh_tomatoes.open_movies_page(movies) return
def main(): #store list of movies movies = [ media.Movie( title = 'The Avengers: Age of Ultron', poster_image_url = 'http://www.movieposterdb.com/posters/15_03/2015/2395427/l_2395427_e80a54df.jpg', trailer_youtube_url = 'https://www.youtube.com/watch?v=JAUoeqvedMo', director = 'Joss Whedon', actors = ['Robert Downey Jr.', 'Chris Evans', 'Chris Hemsworth', 'Scarlett Johansson', 'Mark Ruffalo'], release_date = 'April 23, 2015' ), media.Movie( title = 'X-Men: Days of Future Past', poster_image_url = 'http://www.movieposterdb.com/posters/14_06/2014/1877832/l_1877832_04aaf850.jpg', trailer_youtube_url = 'https://www.youtube.com/watch?v=pK2zYHWDZKo', director = 'Bryan Singer', actors = ['Hugh Jackman', 'Jennifer Lawrence', 'James McAvoy', 'Michael Fassbender', 'Ian McKellen', 'Patrick Stewart', 'Ellen Page', ' Halle Berry', 'Nicholas Hault', 'Fan Bingbing'], release_date = 'May 10, 2014' ), media.Movie( title = 'Pacific Rim', poster_image_url = 'http://www.movieposterdb.com/posters/12_12/2013/1663662/l_1663662_8561742a.jpg', trailer_youtube_url = 'https://www.youtube.com/watch?v=5guMumPFBag', director = 'Guillermo del Toro', actors = ['Charlie Hunnam' 'Rinko Kikuchi', 'Idris Elba', 'Charlie Day', 'Ron Perlman', 'Robery Kazinsky'], release_date = 'July 2, 2013' ) ] #create the webpage dynamically ft.open_movies_page(movies)
def main(): """ Main function of this module Create a new HTML file with movie data This will open a new page in your browser """ fresh_tomatoes.open_movies_page(movies)
def main(): """ This is the main method. :return: """ try: logger = get_logger() set_logger_mode(logger, "WARNING") if len(sys.argv) < 2: raise MovieTrailerException(get_valid_command_line_message()) config_parser = ConfigParser.ConfigParser() config_parser.read(sys.argv[1]) if not config_parser.has_option("run_mode", "mode"): raise MovieTrailerException("Invalid configuration: Missing mode for run_mode") if not config_parser.has_option("run_mode", "filename"): raise MovieTrailerException("Invalid configuration: Missing filename for run_mode") if not config_parser.has_option("logging", "mode"): raise MovieTrailerException("Invalid configuration: Missing mode for logging") set_logger_mode(logger, config_parser.get("logging", "mode")) mode = config_parser.get("run_mode", "mode") filename = config_parser.get("run_mode", "filename") media = Media(logger) media.generate_movie_data(mode, filename) fresh_tomatoes.create_movie_tiles_content(media.movies) fresh_tomatoes.open_movies_page(media.movies) except (MovieTrailerException, IOError), error: logger.error(error.message)
def refreshMovies(): # Create movie instances without any information except title toy_story = media.Movie('Toy Story') avatar = media.Movie('Avatar') hunger_games = media.Movie('The Hunger Games') good_luck_chuck = media.Movie('Good Luck Chuck') divergent = media.Movie('Divergent') TFIOS = media.Movie('The Fault in Our Star') inside_out = media.Movie('Inside Out') up = media.Movie('Up') tangled = media.Movie('Tangled') # The list of movies movies = [avatar, toy_story, hunger_games, good_luck_chuck, divergent, TFIOS, inside_out, up, tangled] # Input all the information inside the movie instances for movie in movies: # Set the information of the movie # Information: Title, storyline, poster url, trailer url, # rating, and rank title = movie.title movie.setTitle(title) movie.setStoryline(movie_storyline[title]) movie.setPoster(movie_poster_url[title]) movie.setTrailer(movie_youtube_url[title]) movie.setRating(movie_rating[title]) movie.setRank(movie_rank[title]) # Transfer the movies information to the website in the form of html file fresh_tomatoes.open_movies_page(movies)
def main(): # We instantiate a number of Movie objects # and use them to generate an HTML page # allowing a user to view box art and trailers. shaun_of_the_dead = media.Movie( "Shaun of the Dead", "http://ia.media-imdb.com/images/M/MV5BMTU2NjA0NDk0NV5BMl5BanBnXkFtZTcwOTA0OTQzMw@@._V1_SX214_AL_.jpg", # noqa "https://www.youtube.com/watch?v=z-lmF5DAssU", "2004", "Edgar Wright", "Simon Pegg, Edgar Wright") hot_fuzz = media.Movie( "Hot Fuzz", "http://ia.media-imdb.com/images/M/MV5BMTIxODg2NDU1MF5BMl5BanBnXkFtZTcwOTc3MDM0MQ@@._V1_SX214_AL_.jpg", # noqa "https://www.youtube.com/watch?v=KOddZELDPmk", "2007", "Edgar Wright", "Edgar Wright, Simon Pegg") paul = media.Movie( "Paul", "https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Paul_poster.jpg/215px-Paul_poster.jpg", # noqa "https://www.youtube.com/watch?v=tav42JTdW4A", "2011", "Greg Mottola", "Simon Pegg, Nick Frost") fantastic_fear = media.Movie( "A Fantastic Fear of Everything", "https://upload.wikimedia.org/wikipedia/en/4/45/Afantasticfearofeverything0001.jpg", # noqa "https://www.youtube.com/watch?v=R9_H34YiKH0", "2012", "Crispian Mills, Chris Hopewell", "Crispian Mills") the_worlds_end = media.Movie( "The World's End", "http://ia.media-imdb.com/images/M/MV5BNzA1MTk1MzY0OV5BMl5BanBnXkFtZTgwNjkzNTUwMDE@._V1_SX214_AL_.jpg", # noqa "https://www.youtube.com/watch?v=hFo7eJR2cvc", "2013", "Edgar Wright", "Simon Pegg, Edgar Wright") hector = media.Movie( "Hector and the Search for Happiness", "http://ia.media-imdb.com/images/M/MV5BNTAzNTIyNDYzNV5BMl5BanBnXkFtZTgwNDg1NjYyMjE@._V1_SX214_AL_.jpg", # noqa "https://www.youtube.com/watch?v=ghCKHlMJoxM", "2014", "Peter Chelsom", "Maria von Heland, Peter Chelsom and Tinker Lindsay (screenplay) and \ François Lelord (novel \"Le voyage d'Hector ou la recherche de \ bonheur\")") movies = [ shaun_of_the_dead, hot_fuzz, paul, fantastic_fear, the_worlds_end, hector] # Generate and open the HTML page fresh_tomatoes.open_movies_page(movies)
def main(): """ Collect a list of movies and then open the fresh_tomatoes page using the movies_list data as page content """ movies_list = create_movies_list() fresh_tomatoes.open_movies_page(movies_list)
def main(): """ Function creates a new HTML file populated with movie data, and opens it in a new browser page. """ fresh_tomatoes.open_movies_page(movies)
def main(): """ Main entry point of Fresh Tomatoes app """ movies = instantiate_movies() # generate html and load the page fresh_tomatoes.open_movies_page(movies)
def main(): """ Main program which needs to be called remotely. A list of Movie objects are defined within the function. The list is passed to the function open_movies_page in fresh_tomatoes.py which creates the movie gallery. """ toy_story = media.Movie("Toy Story", "Toy Story is an animated movie " "about toys come to life.", "https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", # noqa "https://www.youtube.com/watch?v=KYz2wyBy3kc") shawshank = media.Movie("Shawshank Redemption", "Andy Dufresne is sentenced to a life in " "the Shawshank Prison despite being innocent.", "https://upload.wikimedia.org/wikipedia/en/8/81/ShawshankRedemptionMoviePoster.jpg", # noqa "https://www.youtube.com/watch?v=6hB3S9bIaco", "http://www.imdb.com/title/tt0111161/", "1994") happy_gilmore = media.Movie("Happy Gilmore", "A funny story about a hockey player " "who becomes a successful golf professional " "with an extraordinarily long drive.", "https://upload.wikimedia.org/wikipedia/en/b/be/Happygilmoreposter.jpg", # noqa "https://www.youtube.com/watch?v=aa0hSPPW1so", "", "1996") reservoir_dogs = media.Movie("Reservoir Dogs", "Quentin Tarantino's first movie: A group of " "gangsters try to find out why their bank " "robbery failed.", "https://upload.wikimedia.org/wikipedia/en/7/79/Reservoir_Dogs_Game_PS2_Front_Cover.JPG", # noqa "https://www.youtube.com/watch?v=vayksn4Y93A") dark_knight = media.Movie("The Dark Knight Rises", "In his fight against crime in Gotham City, " "Batman is challenged by criminal mastermind " "\"The Joker\".", "https://upload.wikimedia.org/wikipedia/en/8/8a/Dark_Knight.jpg", # noqa "https://www.youtube.com/watch?v=EXeTwQWrcwY", "http://www.imdb.com/title/tt1345836/") pianist = media.Movie("The Pianist", "The movie depicts the survival of polish pianist " "Wladislav Szpilman during World War II.", "https://upload.wikimedia.org/wikipedia/en/a/a6/The_Pianist_movie.jpg", # noqa "https://www.youtube.com/watch?v=CIRLLPa-j9o") movies_list = {toy_story, shawshank, happy_gilmore, reservoir_dogs, dark_knight, pianist} fresh_tomatoes.open_movies_page(movies_list)
def main(): with open(MOVIES_FILE) as data_file: # Load JSON data as standard (non unicode) strings. movie_data = simplejson.loads(data_file.read()) # Inflate live Movies from the dicts created from the JSON. # Note use of dict unpacking. movies = [Movie.Movie(**movie) for movie in movie_data] fresh_tomatoes.open_movies_page(movies)
def setup(): # create media_center object to store movies in my_media_center = media_center.MediaCenter("Caleb's Movies") # create instance of movie class for my favorite movies and add them # to my_media_center object setup_movies(my_media_center) # opens up a webbrowser with movie list fresh_tomatoes.open_movies_page(my_media_center.get_movie_list())
def render_movie_json(filestr): # Open and load json file. f = open(filestr) jsondecode = json.load(f) # Read each node and generate movie object. movies = [] for item in jsondecode[u'movie']: movies.append(p1.Jsoncontainer(item)) # Use the fresh tomatoes movie trailer to make the movie page. ft.open_movies_page(movies)
def main(): # Instantiate list structure and add new instances of Movie class to it. movies = list() # Add Jurassic Park movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/e/e7/Jurassic_Park_poster.jpg", "Jurassic Park", "https://www.youtube.com/watch?v=QWBKEmWWL38", "1993", "PG-13")) # noqa # Add Office Space movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/8/8e/Office_space_poster.jpg", "Office Space", "https://www.youtube.com/watch?v=3_fG_zLbBeU", "1999", "R")) # noqa # Add Toy Story movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "Toy Story", "https://www.youtube.com/watch?v=KYz2wyBy3kc", "1995", "G")) # noqa # Add Blazing Saddles movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/7/7b/Blazing_saddles_movie_poster.jpg", "Blazing Saddles", "https://www.youtube.com/watch?v=VKayG1TrfuE", "1974", "R")) # noqa # Add Spaceballs movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/4/45/Spaceballs.jpg", "Spaceballs", "https://www.youtube.com/watch?v=uWVSVgU-I0s", "1987", "PG")) # noqa # Add The Matrix movies.append(media.Movie( "https://upload.wikimedia.org/wikipedia/en/c/c1/The_Matrix_Poster.jpg", "The Matrix", "https://www.youtube.com/watch?v=vKQi3bBA1y8", "1999", "R")) # noqa # Generate HTML page and open it in the browser. ft.open_movies_page(movies)
def main(): """ Creates the file fresh_tomatoes.html, launches the web browser and loads fresh_tomatoes.html Args: """ # Get the list of movies list_of_movies = get_movie_list() # Create the html page fresh_tomatoes.html, # launch the default webbrowser and load fresh_tomatoes.html fresh_tomatoes.open_movies_page(list_of_movies)
def make_page(): """create move objects and display them in a webbrowser""" mad_max = Movie("Mad Max: Fury Road", "May 15, 2015", "http://ia.media-imdb.com/images/M/MV5BMTUyMTE0ODcxNF5BMl5BanBnXkFtZTgwODE4NDQzNTE@._V1_SY317_CR2,0,214,317_AL_.jpg", "https://www.youtube.com/watch?v=hEJnMQG9ev8") bad_boys = Movie("Bad Boys", "March 25, 1983", "http://www.gstatic.com/tv/thumb/movieposters/6963/p6963_p_v7_aa.jpg", "https://www.youtube.com/watch?v=RRILgwNJNkI") enter_the_void = Movie("Enter the Void", "September 24, 2010", "https://upload.wikimedia.org/wikipedia/en/3/39/Enter-the-void-poster.png", "https://www.youtube.com/watch?v=bKRxDP--e-Y") fresh_tomatoes.open_movies_page([mad_max, bad_boys, enter_the_void])
def main(): # Creation of the instances sharknado = media.Movie("Sharknado", "A tornado fills the LA skyes with...sharks!!", "2013", "http://pixcdn.posterrevolution.com/pr/11" + "/907478f.jpg", "https://www.youtube.com/watch?v=iwsqFR5bh6Q", "http://www.imdb.com/title/tt2724064/") ghostship = media.Movie("The ghost ship", "Welcome to a cruise from hell", "2002", "http://www.impawards.com/2002/posters/ghost_" + "ship.jpg", "https://www.youtube.com/watch?v=Q7poHYtkNZY", "http://www.imdb.com/title/tt0288477/") killerclowns = media.Movie("Killer klowns from outer space", "A tent filled with outerspace clowns lands to\ killus all", "1988", "http://t0.gstatic.com/images?q=tbn:" + "ANd9GcRw1KAKit050yOVzFYHj_5XLfBZWLn7R0_UPMl" + "7hIOzzmvbI3M4", "https://www.youtube.com/watch?v=PcFP8HDFPGQ", "http://www.imdb.com/title/tt0095444/") dragmetohell = media.Movie("Drag me to hell", "It all begins when she gets a curse from an old\ gypsy", "2009", "http://www.impawards.com/2009/posters/drag_" + "me_to_hell.jpg", "https://www.youtube.com/watch?v=BUZTybLlWKI", "http://www.imdb.com/title/tt1127180/") frankenhooker = media.Movie("Frankehooker", "He tried to create the perfect woman...using \ dead hookers parts!", "1990", "http://classic-horror.com/files/images/fran" + "kenhooker_poster.jpg", "https://www.youtube.com/watch?v=AcSN3PEvtQo", "http://www.imdb.com/title/tt0099611/") rocky = media.Movie("The Rocky horror picture show", "Two lovers get involved in a crazy house after his car\ breaks down in the middle of nowhere", "1975", "http://thumbs1.ebaystatic.com/d/l225/m/mcLwQJdw4aos" + "SeWnuijE0iw.jpg", "https://www.youtube.com/watch?v=dEBQ3haBi3c", "http://www.imdb.com/title/tt0073629/") # All instances in array "movies" movies = [sharknado, ghostship, killerclowns, dragmetohell, frankenhooker, rocky] # Call to function open_movies in fresh_tomatoes fresh_tomatoes.open_movies_page(movies)
def open_from_json(filename): """Open the movie site with movies loaded from the JSON file filename""" movie_file = open(filename) movie_json = json.loads(movie_file.read()) movie_file.close() movie_list = [] # Make an object for each movie for movie in movie_json.get('movies', []): movie_list.append(movie_from_dict(movie)) open_movies_page(movie_list)
def createObjects(): # Checking if at least one argument has been passed if len(sys.argv) == 1: print "error: no xml file passed as argument." print "proper usage: python start.py file.xml" elif len(sys.argv) == 2: #proper usage -> create objects fileName = sys.argv[1] fresh_tomatoes.open_movies_page(parsexml(fileName)) else: print "error: you must pass only one xml file as argument." print "proper usage: python start.py file.xml"
def open_movies_page(path_to_file): # Load data from JSON file with open(path_to_file) as data_file: json_data = json.load(data_file) imdb_titles = json_data["movies"] # Generate list of movies movies = [] for title in imdb_titles: movie = media.Movie(title["imdb_title_number"], title["trailer_url"]) movies.append(movie) # Creates and opens the movies webpage fresh_tomatoes.open_movies_page(movies)
def main(): list_of_movies = list() toy_story = media.Movie('Toy Story', 'A story of a boy and his toys come to life.', 'November 22, 1995', 'Tom Hanks, Tim Allen, Don Rickles', 'images/Toystory-Teaser-Poster.JPG', 'www.youtube.com/watch?v=vwyZH85NQC4') list_of_movies.append(toy_story) avatar = media.Movie('Avatar', 'A marine on an alien planet', 'December 18, 2009', 'Sam Worthington, Zoe Saldana, Sigourney Weaver', 'images/Avatar-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=cRdxXPV9GNQ') list_of_movies.append(avatar) school_of_rock = media.Movie('School of Rock', 'Using rock music to learn', 'September 24, 2003', 'Jack Black, Mike White, Joan Cusack', 'images/School_of_Rock-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=5afGGGsxvEA') list_of_movies.append(school_of_rock) minions = media.Movie('Minions', 'Despicable Me', 'July 10, 2015', 'Sandra Bullock, Jon Hamm, Michael Keaton', 'images/Minion-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=P9-FCC6I7u0') list_of_movies.append(minions) charlie_and_chocolate_factory = \ media.Movie('Charlie and Chocolate Factory', 'Inside the Chocolate Factory', 'July 10, 2005', 'Johnny Depp, Freddie Highmore, David Kelly', 'images/charlie_and_the_chocolate_factory-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=OFVGCUIXJls') list_of_movies.append(charlie_and_chocolate_factory) a_few_good_men = media.Movie('A Few Good Men', 'A Few Good Men', 'December 11, 1992', 'Tom Cruise, Jack Nicholson, Demi Moore ', 'images/A_Few_Good_Men-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=ePo91pMcu94') list_of_movies.append(a_few_good_men) fresh_tomatoes.open_movies_page(list_of_movies)
import fresh_tomatoes as ft from media import Movie import tmdbsimple as tmdb # My API key required to access the TMDb API tmdb.API_KEY = "26076ff2e7ca1e76051067205bfb682e" # TMDb movie id's of my favorite movies; in no special order id_array = [ 263115, 14254, 65086, 647, 138843, 82507, 177572, 293660, 1366, 20352, 250546, 111, 254, 264660 ] movie_array = [] # Iterate over id_array and pull appropriate data from TMDb then create and # append Movie objects to movie_array. for x in id_array: temp = tmdb.Movies(x) temp.info() # Pull basic info for movie from TMDb temp.videos() # Pull additional movie info from TMDb # Construct array of Movie objects movie_array.append( Movie(temp.title, temp.overview, temp.poster_path, temp.results[0]["key"])) # Call open_movies_page() after sorting movie_array by each Movie object's # title attribute. ft.open_movies_page(sorted(movie_array, key=lambda movie: movie.title))
# create VENOM Movie Object VENOM = media.Movie( "VENOM", "When Eddie Brock acquires the powers of a symbiote, he will have to release his alter-ego Venom to save his life.", # NOQA "https://www.youtube.com/watch?v=u9Mv98Gr5pY", "https://ia.media-imdb.com/images/M/MV5BMTU3MTQyNjQwM15BMl5BanBnXkFtZTgwNDgxNDczNTM@._V1_SY1000_CR0,0,675,1000_AL_.jpg" ) # NOQA # create Annihilation Movie Object Annihilation = media.Movie( "Annihilation", "A biologist signs up for a dangerous, secret expedition into a mysterious zone where the laws of nature don't apply.", # NOQA "https://www.youtube.com/watch?v=89OP78l9oF0", "https://ia.media-imdb.com/images/M/MV5BMTk2Mjc2NzYxNl5BMl5BanBnXkFtZTgwMTA2OTA1NDM@._V1_SY1000_CR0,0,640,1000_AL_.jpg" ) # NOQA # create Skyscraper Movie Object Skyscraper = media.Movie( "Skyscraper", "FBI Hostage Rescue Team leader and U.S. war veteran Will Sawyer, who now assesses security for skyscrapers.", # NOQA "https://www.youtube.com/watch?v=_pIEzZVqwFs", "https://ia.media-imdb.com/images/M/MV5BOGM3MzQwYzItNDA1Ny00MzIyLTg5Y2QtYTAwMzNmMDU2ZDgxXkEyXkFqcGdeQXVyMjMxOTE0ODA@._V1_SY1000_SX632_AL_.jpg" ) # NOQA # creat list of movies Movies = [MARVEL, FRIENDS, Avengers, VENOM, Annihilation, Skyscraper] # use freshtomatoes class to generate html page with movie list freshtomatoes = fresh_tomatoes.open_movies_page(Movies)
('tron', 'https://www.youtube.com/watch?v=L9szn1QQfas'), ('ski patrol', 'https://www.youtube.com/watch?v=OTyp09bkZbk') ] print 'Assembling movie data...' for favorite in FAVORITES: print ' Fetching metadata for ' + favorite[0] + '...' title = favorite[0] trailer = favorite[1] imdb_movie = omdb.search(title) if imdb_movie['Poster'] == 'N/A': imdb_movie['Poster'] = None if imdb_movie is not None: movie = media.Movie( title=imdb_movie['Title'], trailer_youtube_url=trailer, poster_image_url=imdb_movie['Poster'], rating=imdb_movie['Rated'], release_date=imdb_movie['Released'], plot_summary=imdb_movie['Plot'], running_time=imdb_movie['Runtime'], popularity=imdb_movie['imdbRating']) MOVIES.append(movie) print 'Generating movies page and launching your browser...' fresh_tomatoes.open_movies_page(MOVIES)
# pylint: enable=line-too-long 'https://www.youtube.com/watch?v=ni4tEtuTccc') THE_ORPHANAGE = Movie( 'The Orphanage', # pylint: disable=line-too-long 'https://images-na.ssl-images-amazon.com/images/M/MV5BMTc3MjE0NzQzMV5BMl5BanBnXkFtZTYwMzI0ODc4._V1_.jpg', # pylint: enable=line-too-long 'https://www.youtube.com/watch?v=nUZQgqxIZ6s') FIGHT_CLUB = Movie( 'Fight Club', # pylint: disable=line-too-long 'https://images-na.ssl-images-amazon.com/images/M/MV5BMzc1YmU2ZjEtYWIwMC00ZjM3LWI0NTctMDVlNGQ3YmYwMzE5XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SY999_CR0,0,704,999_AL_.jpg', # pylint: enable=line-too-long 'https://www.youtube.com/watch?v=SUXWAEX2jlg') LOCK_STOCK = Movie( 'Lock, Stock and Two Smoking Barrels', # pylint: disable=line-too-long 'https://images-na.ssl-images-amazon.com/images/M/MV5BMTAyN2JmZmEtNjAyMy00NzYwLThmY2MtYWQ3OGNhNjExMmM4XkEyXkFqcGdeQXVyNDk3NzU2MTQ@._V1_SY1000_CR0,0,666,1000_AL_.jpg', # pylint: enable=line-too-long 'https://www.youtube.com/watch?v=WoZ2kTlwKTk') # END movie definitions # put each movie in a list then call open_movies_page to create/open the webpage MOVIES = [ BIG_LEBOWSKI, NO_COUNTRY, SNATCH, THE_ORPHANAGE, FIGHT_CLUB, LOCK_STOCK ] open_movies_page(MOVIES)
from fresh_tomatoes import open_movies_page ''' This file is a generator for both the movies, their data, and the html page itself. It will create the movies added here, put them in a file, and open that file in your browser. ''' walle = Movie( 'Wall-E', 'https://upload.wikimedia.org/wikipedia/en/c/c2/WALL-Eposter.jpg', 'https://www.youtube.com/watch?v=alIq_wG9FNk') up = Movie( 'Up', 'https://upload.wikimedia.org/wikipedia/en/0/05/Up_%282009_film%29.jpg', 'https://www.youtube.com/watch?v=pkqzFUhGPJg') avatar = Movie( 'Avatar', 'https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg', 'https://www.youtube.com/watch?v=cRdxXPV9GNQ') movies = (walle, up, avatar) open_movies_page(movies) ''' This function opens the created list of movies, generates an HTML file with the movies inside, saves said file, and opens a new browser tab from the HTML file. '''
#A Python class to store movie's data. class movie: title = '' poster_image_url = '' trailer_youtube_url = '' def save(self): """ Add Movie instance to the global variable movies. :return: List """ global movies movies.append(self) return movies #Loop over the nested list in our ou MOVIES_DATA tuple for m in MOVIES_DATA: f = movie() #Initialize a movie instance. f.title = m[ 0] #Populate movie instance attribute with corresponding data from the nested list. f.poster_image_url = m[1] f.trailer_youtube_url = m[2] f.save() #Add the movie instance to the global movie list. from fresh_tomatoes import open_movies_page open_movies_page(movies) #Create the page using the generated list.
"https://goo.gl/YSEU5c", "https://youtu.be/6ZfuNTqbHE8") maze_runner2 = media.Movie( "Maze Runner 2", "2 hours 13 minutes", "Few selected ones save themselves from " "an organisation called WCKD.", "Sci-Fi, Dystopian, Adventure", "18 September 2015", "6.3", "https://goo.gl/8XtvMQ", "https://youtu.be/SDofO3P2HpE") thor_ragnarok = media.Movie( "Thor Ragnarok", "2 hours 10 minutes", "Thor fights his evil sister, Hela, " "and protects Asgard from her.", "Comedy, Fantasy, Action", "3 November 2017", "8.0", "https://goo.gl/5SkAsT", "https://youtu.be/v7MGUNV8MxU") justice_league = media.Movie( "Justice League", "2 hours", "The Justice League assembles to defeat " "Darkseid.", "Action, Sci-Fi, Fantasy", "15 November 2017", "6.8", "https://goo.gl/x1BpEi", "https://youtu.be/r9-DM9uBtVI") # Create a list of Movie instances. movies = [ the_terminator, avatar, avengers3, maze_runner2, thor_ragnarok, justice_league ] # Generate a Web page by passing the list of Movie instances. fresh_tomatoes.open_movies_page(movies)
upcoming_movie_objects = [] now_playing_movie_objects = [] for i in range(0, len(upcoming_titles)): create_movie_object = media.Movie( upcoming_titles[i], upcoming_storylines[i], upcoming_posters[i], upcoming_trailer_url[i], upcoming_release_dates[i]) upcoming_movie_objects.append(create_movie_object) for i in range(0, len(now_playing_titles)): create_movie_object = media.Movie( now_playing_titles[i], now_playing_storylines[i], now_playing_posters[i], now_playing_trailer_url[i], now_playing_release_dates[i]) now_playing_movie_objects.append(create_movie_object) all_movie_objects = [] all_movie_objects.extend(upcoming_movie_objects) all_movie_objects.extend(now_playing_movie_objects) # fresh_tomatoes.py takes in a list of media.Movie objects and generates html # code to be delivered. The website is also automatically opened in the # browser. fresh_tomatoes.open_movies_page(all_movie_objects)
"The Gods Must Be Crazy", "A Coca-Cola bottle dropped from an airplane raises havoc", "among a normally peaceful tribe of African bushmen", "who believe it to be a utensil of the gods.", "- Directed by Jamie Uys(imbd.com)", "Comedy/Slapstick ", "Nxau Toma", " Jamie Uys", "1980", "https://www.gstatic.com/tv/thumb/v22vodart/8763/p8763_v_v8_aa.jpg", # noqa "https://www.youtube.com/watch?v=3EG0dH1oN7k") # noqa raju_gadhi_3 = media.Movie( "Raju Gari Gadhi 3", "Ashwin and Maya, a couple in love, learn of the presence of ", "an evil spirit in their life. Determined to bring their life", "back to normalcy, Ashwin sets out on a spooky journey to ", "safeguard his love.", "- Directed by Omkar(imbd.com)", "Horror/Triller ", "Avika Gor", " Omkar", "2019", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTTlCQCl_942L25O7csT28VwYX2ysjKC3qyw3iawNa3SLaTCWfM", # noqa "https://www.youtube.com/watch?v=boJtBqIJ6Ls&feature=emb_title") # noqa # Creating a list containing the instances of the Movie just created movies = [the_Avengers, Bahubali, super_30, the_gods, raju_gadhi_3] # Calling the open_movies_page to create the page with the Movies fresh_tomatoes.open_movies_page(movies, media.Movie.TOTAL_INSTANCES)
"https://upload.wikimedia.org/wikipedia/en/b/bc/Interstellar_film_poster.jpg", "https://www.youtube.com/watch?v=2LqzF5WauAw") hunger_games = media.Movie( "Hunger Games", "Adventure, Sci-Fi, Thriller", "The World Will Be Watching.", "2h 22min", "PG-13", "https://upload.wikimedia.org/wikipedia/en/4/42/HungerGamesPoster.jpg", "https://www.youtube.com/watch?v=PbA63a7H0bo") Queen = media.Movie( "Queen", "Adventure, Comedy, Drama", "Everything in life happens for the good.", "2h 26min", "R", "https://upload.wikimedia.org/wikipedia/en/4/45/QueenMoviePoster7thMarch.jpg", "https://www.youtube.com/watch?v=KGC6vl3lzf0") fight_club = media.Movie( "Fight Club", "Drama", "Losing all hope is freedom.", "2h 19min", "R", "https://upload.wikimedia.org/wikipedia/en/f/fc/Fight_Club_poster.jpg", "https://www.youtube.com/watch?v=BdJKm16Co6M") movies = [ forrest_gump, silver_linings_Playbook, the_shawshank_redemption, jerry_maguire, inception, interstellar, hunger_games, Queen, fight_club ] # Stores the movie object in a list # print (media.Movie.VALID_RATINGS) fresh_tomatoes.open_movies_page( movies) # Creates the output which is a website
"Toy Story", "A story of a boy and his toys that come to life", "https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "https://www.youtube.com/watch?v=Bj4gS1JQzjk") avatar = media.Movie( "Avatar", "A marine on an alien planet", "https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg", "https://www.youtube.com/watch?v=5PSNL1qE6VY") game_of_thrones = media.TvShow( "Game of Thrones", "An American fantasy drama television series created by David Benioff and D. B. Weiss.", "https://upload.wikimedia.org/wikipedia/en/0/04/Game_of_Thrones_Season_7.jpg", "https://www.youtube.com/watch?v=giYeaKsXnsI", 7, 4, "HBO") secret_forest = media.TvShow( "Stranger", "a South Korean television series starring Jo Seung-woo and Bae Doo-na.", "https://upload.wikimedia.org/wikipedia/en/d/d8/Stranger_Poster.jpg", "https://youtu.be/xUOSR7GDCqY", 1, 2, "tvN") videos = [toy_story, avatar, game_of_thrones, secret_forest] fresh_tomatoes.open_movies_page(videos) # print media.Movie.valid_rating # print media.Movie.__doc__ # >> This class provides a way to store movie related information # print media.Movie.__module__ # media # print media.Movie.__name__ # Movie # game_of_thrones.show_trailer()
" be after him, and he takes a chance on discovering" " what he has always suspected: that the world is " " not quite what it seems to be and a sinister" " conspiracy is at work.", "https://upload.wikimedia.org/wikipedia/en/c/c1/The_Matrix_Poster.jpg", # NOQA "https://www.youtube.com/watch?v=m8e-FF8MsqU") pulp_fiction = media.Movie( "Pulp Fiction", "Vincent Vega and Jules Winnfield are hitmen with a" " penchant for philosophical discussions. In this" " ultra-hip, multi-strand crime movie, their " " storyline is interwoven with those of their boss," " gangster Marsellus Wallace ; his actress wife," " Mia; struggling boxer Butch Coolidge; master" " fixer Winston Wolfe and a nervous pair of armed" " robbers, Pumpkin and Honey Bunny", "http://www.gstatic.com/tv/thumb/movieposters/15684/p15684_p_v8_ac.jpg", # NOQA "https://www.youtube.com/watch?v=ewlwcEBTvcg") donnie_darko = media.Movie( "Donnie Darko", "The film follows the adventures of the troubled" " title character as he seeks the meaning behind" " his Doomsday-related visions.", "https://upload.wikimedia.org/wikipedia/en/d/db/Donnie_Darko_poster.jpg", # NOQA "https://www.youtube.com/watch?v=qdKbNuhXWvQ") movies = [the_matrix, pulp_fiction, donnie_darko] # Array of movies to load fresh_tomatoes.open_movies_page(movies) # Starts the html page with movies
title = "Game of Thrones" storyline = "Several noble families fight for control \ of the mythical land of Westeros." image_url = "http://ia.media-imdb.com/images/M/MV5BNTgxOTI4NzY2M15BMl5BanBnXkFtZTgwMjY3MTM2NDE@._V1_SX214_AL_.jpg" # noqa youtube_url = "https://youtu.be/8ixEWrTLiZg" duration = "55" num_seasons = "6" game_of_thrones = media.TvShow( title, duration, storyline, image_url, youtube_url, num_seasons) title = "Cosmos" storyline = "Astronomer Carl Sagan leads us on an engaging \ guided tour of the various elements and \ cosmological theories of the universe." image_url = "http://ia.media-imdb.com/images/M/MV5BMTI0NTg5MjA5OF5BMl5BanBnXkFtZTcwNDMxMTEyMQ@@._V1_SY317_CR13,0,214,317_AL_.jpg" # noqa youtube_url = "https://youtu.be/bSxHZPoQ4JQ" duration = "60" num_seasons = "1" cosmos = media.TvShow( title, duration, storyline, image_url, youtube_url, num_seasons) # put all the objects into an array, # so they can be parameter to the function open_movies_page movies_tvshow = [toy_story, avatar, school_of_rock, the_dark_knight, friends_with_benefits, breaking_bad, game_of_thrones, cosmos] # run the function that will generate the html file fresh_tomatoes.open_movies_page(movies_tvshow)
[ "Despicable Me 3", "https://upload.wikimedia.org/wikipedia/en/9/91/Despicable_Me_3_%282017%29_Teaser_Poster.jpg", "https://www.youtube.com/watch?v=gRDbiX3Zm8c" ], [ "Wolf Warriors 2", "https://upload.wikimedia.org/wikipedia/en/b/b5/Wolf_Warriors_2_poster.jpeg", "https://www.youtube.com/watch?v=fkqGiPB2D8M" ], [ "Logan", "https://upload.wikimedia.org/wikipedia/en/3/37/Logan_2017_poster.jpg", "https://www.youtube.com/watch?v=DekuSxJgpbY" ], [ "Transformers: The Last Knight", "https://upload.wikimedia.org/wikipedia/en/2/26/Transformers_The_Last_Knight_poster.jpg", "https://www.youtube.com/watch?v=sQm3djLYWB8" ], ] # list to hold media.Movie instances. movie_list = [] for movie_item in movie_data: movie_record = media.Movie(movie_item[0], movie_item[1], movie_item[2]) movie_list.append(movie_record) fresh_tomatoes.open_movies_page(movie_list)
'https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg', 'https: // www.youtube.com / watch?v = KYz2wyBy3kc') #create an instance of the movie avatar avatar = media.Movie('Avatar', 'A paraplegic ex-marine finds a new life on the distant planet of Pandora', 'https://www.movieposter.com/posters/archive/main/98/MPW-49246', 'https://www.youtube.com/watch?v=5PSNL1qE6VY') #create an instance of the movie Conjuring 2 conjuring2 = media.Movie('Conjuring 2', 'Ed and Lorrain explore the Enfield Poltergeist tale in London 1973', 'http://www.impawards.com/2016/posters/conjuring_two_ver3.jpg', 'https://www.youtube.com/watch?v=KyA9AtUOqRM') #create an instance of the movie Tarzan tarzan = media.Movie('Tarzan', 'Tarzan is given the task of abolishing slavery and save Jane', 'http://www.impawards.com/2016/posters/tarzan_ver4.jpg', 'https://www.youtube.com/watch?v=5PSNL1qE6VY') #create an instance of the movie titanic titanic = media.Movie('Titanic', 'The Journey of Jack and Rose ', 'http://movieposters2.com/images/728486-b.jpg', 'https://www.youtube.com/watch?v=2e-eXJ6HgkQ') #create an instance of the movie frozen frozen = media.Movie('Frozen', 'The story of two sisters', 'https://s-media-cache-ak0.pinimg.com/564x/4e/cc/3f/4ecc3fca4348d86904c75420d2c8fb81.jpg', 'https://www.youtube.com/watch?v=TbQm5doF_Uc') movies=[toy_story,avatar,conjuring2,tarzan,titanic,frozen] #create a list of movies fresh_tomatoes.open_movies_page(movies) # open the movies_page using the fresh_tomatoes.py html file
"Sam Witwicky and the Autobots must unravel the secrets of a Cybertronian spacecraft hidden on the moon before the Decepticons can use it for their own evil schemes.", "http://t0.gstatic.com/images?q=tbn:ANd9GcQA5ydza4Rar3DEOsd0Wc6wL-6gpIzwjPZzfpb2vLNYxFRgm3RB", "https://www.youtube.com/watch?v=kHRf01Gjosk") transformers_four = media.Movie( "Transformers: Age of Extinction", "The Autobots, a faction of robots from the planet Cybertron, are hunted down by an elite CIA black ops unit and a ruthless bounty hunter. They turn to a struggling inventor and his daughter for help.", "http://t0.gstatic.com/images?q=tbn:ANd9GcQiog19jyNYJ3uTY5pPNBCaWcS-mfJ8HLBLd58sGwB-1FObtFYX", "https://www.youtube.com/watch?v=dYDGqmxMZFI") transformers_five = media.Movie( "Transformers: The Last Knight", "Humans are at war with the Transformers, and Optimus Prime is gone. The key to saving the future lies buried in the secrets of the past and the hidden history of Transformers on Earth. Now, it's up to the unlikely alliance of inventor Cade Yeager, Bumblebee, an English lord and an Oxford professor to save the world.", "http://t1.gstatic.com/images?q=tbn:ANd9GcQfKnoR3RsDT6gq3eEHzvH4XCt0Fal6sHiMZ7M98eyTF3ahSAPJ", "https://www.youtube.com/watch?v=R4nrFuJedyk") transformers_six = media.Movie( "Bumblebee: The Movie", "On the run in the year 1987, Bumblebee the Autobot seeks refuge in a junkyard in a small California beach town. Charlie, on the brink of turning 18 years old and trying to find her place in the world, soon discovers the battle-scarred and broken Bumblebee. When Charlie revives him, she quickly learns that this is no ordinary yellow Volkswagen.", "https://www.bioskoptoday.com/wp-content/uploads/2017/06/Transformers-6.jpg", "https://www.youtube.com/watch?v=ier0kkKn6bs") #creating an array of the instances we just created, so as to pass it as a parameterr to open_movies_page function. movies_array = [ transformers, transformers_two, transformers_three, transformers_four, transformers_five, transformers_six ] #Calling open_movies_page function from fresh_tomatoes file. fresh_tomatoes.open_movies_page(movies_array)
# Different TvShow instances wall_street_warriors = media.TvShow( "Wall Street Warriors", "season1, 2, 3", "http://ecx.images-amazon.com/images/I/51uYlndI-IL.jpg", # noqa "https://www.youtube.com/watch?v=nyRiuv4EDB4") # noqa traders = media.TvShow( "Traders", "season1, 2, 3, 4, 5", "http://www.gstatic.com/tv/thumb/tvbanners/184285/p184285_b_v8_ad.jpg", # noqa "https://www.youtube.com/watch?v=n5RbftJr5CA") # noqa # Collect all the instances and put them into one array movies_and_tvshows = [ wall_street, inside_job, margin_call, capitalism_a_love_story, barbarians_at_the_gate, the_wolf_of_wall_street, the_big_short, wall_street_warriors, traders, ] # Execute the fuction open_movies_page fresh_tomatoes.open_movies_page(movies_and_tvshows)
# -*- coding: UTF-8 -*- import media import fresh_tomatoes #创建一个电影实例 kill_zone = media.Movie('Kill Zone', 'Chinese Kong Fu', 'http://p9.qhmsg.com/t01dbac23bf78cce62a.jpg', 'https://www.youtube.com/watch?v=ZWOmy3s4a5Y') #创建一个电影实例 kill_zone_2 = media.Movie( 'Kill Zone 2', 'Chinese Kong Fu', 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1495367381454&di=c5a185d34d888661f58a36e38a9bda09&imgtype=0&src=http%3A%2F%2Fch.bonafilm.cn%2Fupload%2FPicture%2F2013%2F20150922035140.jpg', 'https://www.youtube.com/watch?v=GXh0zf2Qbbc') movies = [kill_zone, kill_zone_2] #fresh_tomatoes中的输入是一个又多个电影实例组成的列表 fresh_tomatoes.open_movies_page( movies) #调用fresh_tomatoes中的open_movies_page方法,生成电影网页
import media # Import media to create instances of movie object import fresh_tomatoes #Import fresh_tomatoes that will be used to display HTML of my favorite movies page """Create instances of movie object for my favourite movies. This is represented with the title, story, image, trailer url, and director""" toy_story = media.Movie( "Toy Story", "A story of a boy and his toys that come to life", "http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "https://www.youtube.com/watch?v=KYz2wyBy3kc", "John Lasseter") avatar = media.Movie( "Avatar", "A marine on an alien planet", "https://upload.wikimedia.org/wikipedia/en/thumb/b/b0/Avatar-Teaser-Poster.jpg/220px-Avatar-Teaser-Poster.jpg", "https://www.youtube.com/watch?v=a0CDJZu4M5I", "James Cameron") the_shawshank_redemption = media.Movie( "The Shawshank Redemption", "Perseverance against all odds", "https://upload.wikimedia.org/wikipedia/en/thumb/8/81/ShawshankRedemptionMoviePoster.jpg/220px-ShawshankRedemptionMoviePoster.jpg", "www.youtube.com/watch?v=6hB3S9bIaco", "Frank Darabont") city_of_god = media.Movie( "City of God", "Young criminals in Rio", "https://upload.wikimedia.org/wikipedia/en/thumb/1/10/CidadedeDeus.jpg/220px-CidadedeDeus.jpg", "www.youtube.com/watch?v=ioUE_5wpg_E", "Fernando Meirelles & Katia Lund") movies = [toy_story, avatar, the_shawshank_redemption, city_of_god] # Store the movie instances in a list fresh_tomatoes.open_movies_page( movies) # Create HTML file output and display on default browser
class Movie(): def __init__(self, movietitle, story, moviepoaster, movietrailer): self.title = movietitle self.storyLine = story self.poaster = moviepoaster self.trilar = movietrailer jonwick = Movie('Jhon wick ', 'An ex-hit-man comes out of retirement to track down the gangsters that killed his dog and took everything from him.', 'https://images-na.ssl-images-amazon.com/images/I/41i2SoUoRjL.jpg', 'https://www.youtube.com/watch?v=RllJtOw0USI') TheShawshankRedemption = Movie('The Shawshank Redemption ', 'Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.', 'https://m.media-amazon.com/images/M/MV5BMDFkYTc0MGEtZmNhMC00ZDIzLWFmNTEtODM1ZmRlYWMwMWFmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UX182_CR0,0,182,268_AL_.jpg', 'https://www.youtube.com/watch?v=BXUEUwwgIyU') TheGodfather = Movie( 'The Godfather', 'The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.', 'https://m.media-amazon.com/images/M/MV5BM2MyNjYxNmUtYTAwNi00MTYxLWJmNWYtYzZlODY3ZTk3OTFlXkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_UY268_CR3,0,182,268_AL_.jpg', 'https://www.youtube.com/watch?v=sY1S34973zA') TheDarkKnight = Movie('The Dark Knight', 'When the menace known as The Joker emerges from his mysterious past, he wreaks havoc and chaos on the people of Gotham. The Dark Knight must accept one of the greatest psychological and physical tests of his ability to fight injustice.', 'https://m.media-amazon.com/images/M/MV5BMTMxNTMwODM0NF5BMl5BanBnXkFtZTcwODAyMTk2Mw@@._V1_UX182_CR0,0,182,268_AL_.jpg', 'https://www.youtube.com/watch?v=_PZpmTj1Q8Q') Inception = Movie('Inception', 'A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O.', 'https://m.media-amazon.com/images/M/MV5BMjAxMzY3NjcxNF5BMl5BanBnXkFtZTcwNTI5OTM0Mw@@._V1_UX182_CR0,0,182,268_AL_.jpg', 'https://www.youtube.com/watch?v=8hP9D6kZseM') films = [jonwick, TheShawshankRedemption, TheGodfather, TheDarkKnight, Inception] fresh_tomatoes.open_movies_page(films)