Ejemplo n.º 1
0
def main():
    """
    Main function to store a list of Movie objects
    then generate proper HTML file.
    """
    mission_impossible_vi = Movie(
        title="Mission Impossible VI",
        poster_image_url="images/Mission-Impossible-Poster.jpg",
        trailer_youtube_url="https://www.youtube.com/watch?v=hR-0po0hzDQ")
    transformer_iii = Movie(
        title="Transformer III",
        poster_image_url="images/TransformersIII-Poster.jpg",
        trailer_youtube_url="https://www.youtube.com/watch?v=kHRf01Gjosk")
    independence_day = Movie(
        title="Independence Day",
        poster_image_url="images/Independence-Day-Poster.jpg",
        trailer_youtube_url="https://www.youtube.com/watch?v=NZZvtQtdbzM")
    manchester_by_the_sea = Movie(
        title="Manchester by the Sea",
        poster_image_url="images/Manchester-By-The-Sea-Poster.jpg",
        trailer_youtube_url="https://www.youtube.com/watch?v=gsVoD0pTge0")
    movies = \
        [mission_impossible_vi,
         transformer_iii,
         independence_day,
         manchester_by_the_sea]
    fresh_tomatoes.open_movies_page(movies)
Ejemplo n.º 2
0
    def load_default_movies(self):
        """
        Creates movie objects and adds to the movies list.
        Returns: None
        """

        self.movies["Uriyadi"] = (Movie(
            "Uriyadi",
            "A political thriller set in the late 1990s, revolving around an engineering college in the interiors of Tamil Nadu",
            "https://upload.wikimedia.org/wikipedia/commons/f/f0/Uriyadi_Tamil_Movie.jpg",
            "https://www.youtube.com/watch?v=hifdGU654R4"))

        self.movies["Iraivi"] = (Movie(
            "Iraivi",
            "Three women become liberated after unfortunate circumstances drive their husbands to become involved in crime.",
            "https://upload.wikimedia.org/wikipedia/en/3/36/Iraivi.jpg",
            "https://www.youtube.com/watch?v=DH3iKNTT9-M"))

        self.movies["Kabali"] = (Movie(
            "Kabali",
            "An aged gangster tries to protect his family and his business from his enemies.",
            "https://upload.wikimedia.org/wikipedia/en/9/9e/Rajinikanth_in_Kabali.jpg",
            "https://www.youtube.com/watch?v=9mdJV5-eias"))

        self.movies["Virumandi"] = (Movie(
            "Virumandi",
            "A reporter researching the death penalty meets Virumandi and Kuthala. While listening to their versions of the same story, she realises that Virumandi is being punished for a crime he did not commit.",
            "https://upload.wikimedia.org/wikipedia/en/thumb/7/75/Virumaandi.jpg/220px-Virumaandi.jpg",
            "https://www.youtube.com/watch?v=fLhW-oYtd4Q"))
Ejemplo n.º 3
0
def main():
    terminator2 = Movie("Terminator 2: Judgment Day", "https://goo.gl/x1z2jh",
                        "https://www.youtube.com/watch?v=-W8CegO_Ixw")

    desperate_measures = Movie("Desperate Measures", "https://goo.gl/TYLtYW",
                               "https://www.youtube.com/watch?v=i63VGK1ElN0")

    the_other_guys = Movie("The Other Guys", "https://goo.gl/52CCzt",
                           "https://www.youtube.com/watch?v=D6WOoUG1eNo")

    movie_list = [terminator2, desperate_measures, the_other_guys]
    fresh_tomatoes.open_movies_page(movie_list)
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])
Ejemplo n.º 5
0
def main():
    """Function called when executed as standalone script"""
    movies = []
    # Add each movie and respective data to list of movies
    movies.append(
        Movie("Toy Story", "http://blog.nileslibrary.org/assets/toystory.jpg",
              "https://www.youtube.com/watch?v=KYz2wyBy3kc", 1995, 4.2))

    movies.append(
        Movie(
            "Toy Story 2",
            "http://ia.media-imdb.com/images/M/MV5BMTQ0OTU0NTcyNl5BMl5BanBnXkFtZTcwOTk5Mjc4OA@@._V1_SX640_SY720_.jpg",
            "https://www.youtube.com/watch?v=Lu0sotERXhI", 1999, 4.0))

    movies.append(
        Movie(
            "Toy Story 3",
            "http://ia.media-imdb.com/images/M/MV5BMTgxOTY4Mjc0MF5BMl5BanBnXkFtZTcwNTA4MDQyMw@@._V1_SX640_SY720_.jpg",
            "https://www.youtube.com/watch?v=JcpWXaA2qeg", 2010, 4.2))

    movies.append(
        Movie(
            "WALL-E",
            "http://images1.fanpop.com/images/image_uploads/Official-Movie-Poster-wall-e-818680_565_837.jpg",
            "https://www.youtube.com/watch?v=alIq_wG9FNk", 2008, 4.2))

    movies.append(
        Movie(
            "Cars",
            "https://www.movieposter.com/posters/archive/main/98/MPW-49378w",
            "https://www.youtube.com/watch?v=WGByijP0Leo", 2006, 3.7))

    movies.append(
        Movie(
            "Ratatouille",
            "http://pixar-planet.fr/wp-content/uploads/2010/04/affiche-ratatouille-06.jpg",
            "https://www.youtube.com/watch?v=KQUpZqshj7M", 2007, 4.0))

    movies.append(
        Movie(
            "Shrek",
            "http://vignette4.wikia.nocookie.net/shrek/images/2/2a/Shrek1.jpg/revision/latest?cb=20150119043746",
            "https://www.youtube.com/watch?v=W37DlG1i61s", 2001, 4.0))

    movies.append(
        Movie(
            "Shrek 2",
            "http://vignette3.wikia.nocookie.net/voiceacting/images/1/12/Shrek_2_DVD_Cover.jpg/revision/latest?cb=20130208181328",
            "https://www.youtube.com/watch?v=V6X5ti4YlG8", 2004, 3.6))

    movies.append(
        Movie(
            "Shrek the Third",
            "http://www.gstatic.com/tv/thumb/movieposters/159731/p159731_p_v7_aa.jpg",
            "https://www.youtube.com/watch?v=ZGmRsNM0JXM", 2007, 3.0))
    # Send list of movies to be displayed via HTML
    fresh_tomatoes.open_movies_page(movies)
Ejemplo n.º 6
0
def init(movies_path):
    """Function to initialize the data for the application.

    Parameters:
    - movies_path - path to a file from which the initial data should
    be taken

    Returns: a list of Movie objects
    """
    try:
        # Open file specified in movies_path and populate movies list
        with open(movies_path) as movies_file:
            movies_list = []
            # Get contents of the file by lines
            contents = movies_file.readlines()
            for movie in contents:
                # Strip newline and split by comma
                movie_details = movie.rstrip().split(',')
                if len(movie_details) != 5:
                    raise ValidationError('Incorrect number of movie details')
                # Instantiate Movie class and append it to the list
                movies_list.append(Movie(*movie_details))

        if not movies_list:
            raise ValidationError('Empty file')

        return movies_list
    except IOError:
        raise ValidationError('No such file')
def get_data():
    # To get popular movie data and return a list of Movie instance
    url = 'https://api.themoviedb.org/3/movie/popular?api_key=1f4817acb34ea3063d54e2f4c641c5cb&language=en-US&page=1'
    response = request.urlopen(url)
    # opening the url and getting the data
    response_read = str(response.read())

    # Removing unwanted characters from response_read
    response_read = response_read.replace('b\'', '')
    response_read = response_read.replace('\'', '')
    response_read = response_read.replace('\\\\\"', '')
    response_read = response_read.replace('\\', '')

    # Converting String to Python Dictionary
    movie_dict = yaml.load(response_read)['results']

    # list to store Movie instances
    movies = []
    for movie in movie_dict:
        if(movie['original_language'] == 'en'):
            trailer = get_trailer_link(movie['id'])
            if(trailer is None):
                # if trailer does not exist do not include the movie
                continue
            storyline = movie["overview"]
            title = movie['title']
            poster = get_poster_link(movie['poster_path'])
            # Movie Instance and adding them to movie list
            movies.append(
                Movie(title, storyline, poster, trailer)
            )
    return movies  # returing the list of Movie instance
Ejemplo n.º 8
0
def load_movies_from_file(path):
    """Load movies from file and create the related classes, returning them
    as a list"""
    # Check if provided path exists, including relative folders
    split_path = path.split("/")[:-1]
    check_folder = ""
    for folder in split_path:
        check_folder += folder + "/"
        if not os.path.isdir(check_folder):
            print("""The directory specified do not exist,
                please check the path to the movie file.""")
            #Return empty movie list if failed to load file
            return []

    if os.path.isfile(path):
        # Open file, parse it as json
        with open(path) as movie_file:
            json_object = json.loads(movie_file.read())
            movie_list = []
            for element in json_object:
                movie_list.append(
                    Movie(element["title"], element["poster"],
                          element["trailer"], element["date"],
                          element["main_cast"]))
            return movie_list
    else:
        print("There is no file to load movies from, check provided file.")
def getMovieObject(movie_dict, key):
    title = movie_dict['title']
    poster_path = movie_dict['poster_path']
    trailer_path = getTrailerPath(movie_dict['id'], key)
    storyline = movie_dict['overview']
    release_date = movie_dict['release_date']
    return Movie(title, poster_path, trailer_path, storyline, release_date)
Ejemplo n.º 10
0
    def _convert_movie_detail(self, response):
        """Convert a movie API detail response to a Movie instance

        Arguments:
            response (dict): The API response containing movie results

        Returns:
            Movie -- Movie instance
        """

        youtube_url = None

        # find the trailer url in video results
        for video in response['videos']['results']:
            if(video['type'] == 'Trailer' and video['site'] == 'YouTube'):
                youtube_url = 'https://www.youtube.com/watch?v=' + video['key']

        return Movie(
            response['id'],
            response['title'],
            response['overview'],
            TMDB.image_url + response['poster_path'],
            response['release_date'],
            youtube_url
        )
Ejemplo n.º 11
0
def build_movie(movie_url):
    """Build movie object from movie URL page."""
    response = requests.get(movie_url)
    html = Soup(response.text, 'html.parser')
    title_tag = html.find('h1', {'itemprop': 'name'})
    title, year = title_tag.text.strip().split('\xa0')
    year = year[1:-1]
    duration = html.find('time', {'itemprop': 'duration'}).text.strip()
    duration_minutes = calculate_mins(duration)
    rating = html.find('span', {'itemprop': 'ratingValue'}).text
    mpaa_rating = html.find('meta', {
        'itemprop': 'contentRating'
    }).attrs['content']
    if mpaa_rating.upper() not in Movie.MPAA_RATINGS:
        mpaa_rating = ''
    poster_url = html.find('div', {'class': 'poster'}).find('img').attrs['src']
    synopsis = html.find('div', {'class': 'summary_text'}).text.strip()
    cast = html.find('table', {'class': 'cast_list'})
    cast_links = cast.find_all('td', {'itemprop': 'actor'})
    starring = [cast_links[0].text.strip(), cast_links[1].text.strip()]
    trailer_tag = html.find('a', {'itemprop': 'trailer'})
    trailer_url = trailer_tag.attrs['data-video'] if trailer_tag else ''

    movie = Movie(title, synopsis, rating, poster_url, duration_minutes,
                  starring, trailer_url, mpaa_rating, year)
    return movie
def get_movie(tmdb_id):
    """Returns a Movie object given the TMDb ID of a movie.

    Args:
        tmdb_id (str): The unique ID for a movie on the TMDb website.

    Returns:
        An object of class Movie.
    """

    # TMDb API key
    api_key = "a67cb6ea86667935513fc0b0e51f0d1e"

    # Retrieve movie information
    url = ("https://api.themoviedb.org/3/movie/" + tmdb_id + "?api_key=" +
           api_key)
    movie = json.load(urllib.urlopen(url))
    title = movie['original_title']
    duration = movie['runtime']
    overview = movie['overview']
    poster_image_url = "http://image.tmdb.org/t/p/w1920" + movie['poster_path']

    # Retrieve YouTube trailer URL
    url = ("https://api.themoviedb.org/3/movie/" + tmdb_id +
           "/videos?api_key=" + api_key)
    movie = json.load(urllib.urlopen(url))
    trailer_youtube_url = ("https://www.youtube.com/watch?v=" +
                           movie['results'][0]['key'])

    # Return a movie object for the given movie
    return Movie(title, duration, overview, poster_image_url,
                 trailer_youtube_url)
Ejemplo n.º 13
0
    def _extract_movie(self, html_content):
        """Extract single movie information.

        Parameters
        ---
        html_content : string
            The HTML content fragment of one single movie information.

        Returns
        ---
        Movie
            A single `Movie` object.
        """
        # get title and trailer_url through regexp
        match = re.compile('<a href="([^"]+)" title="([^"]+)"',
                           re.DOTALL).search(html_content)
        if match:
            title = match.group(2)
            trailer_url = 'http:' + match.group(1)

        # get poster_image_url through regexp
        match = re.compile('<img.+?src="([^"]+)"',
                           re.DOTALL).search(html_content)
        if match:
            poster_image_url = match.group(1)

        movie = Movie(title, poster_image_url, trailer_url)
        return movie
Ejemplo n.º 14
0
def create_movies_from_json(json_file):
    """Transform a json file in a Movie instance"""
    movie_list = []
    for data in json.load(open(json_file)):
        movie = Movie(data["title"], data["image"], data["trailer"])
        movie_list.append(movie)
    return movie_list
Ejemplo n.º 15
0
def get_douban(key):
    """
    This function for search movie info with key from douban api.

    Parameters:
        key - search key word.

    Returns:
        Return movie object list.
    """
    response = urllib.urlopen('https://api.douban.com/v2/movie/search?q='+ key +'&count=' + str(search_count))
    html = response.read()
    jsonMap = json.loads(html)
    movies = []
    for subject in jsonMap['subjects']:
        alt = subject['alt']
        play_url = 'http://v.youku.com/v_show/id_XMjg0ODU2MDY4MA==.html?spm=a2hww.20027244.ykRecommend.5~5!2~5~5~A'
        movie = Movie(
                subject['title'],#电影标题
                subject['rating']['average'],#电影评分
                subject['rating']['stars'],#星星数
                subject['collect_count'],#电影收藏次数
                subject['genres'],#电影分类
                subject['casts'],#电影主演
                subject['directors'],#电影导演
                subject['year'],#上映时间
                subject['images']['medium'],#电影海报
                play_url
                )
        movies.append(movie)

    return movies if len(movies) > 0 else None
Ejemplo n.º 16
0
def main():
    movies = []
    for title, urls in d.items():
        poster = urls[0]
        trailer = urls[1]
        movies.append(Movie(title, poster, trailer))

    ft.open_movies_page(movies)
Ejemplo n.º 17
0
def getAllMovies():
    """
	Returns:
		An array of movies initialized with their supporting data.
	"""

    return [
        Movie("Gladiator",
              "https://www.movieposter.com/posters/archive/main/22/A70-11370",
              "https://www.youtube.com/watch?v=DQc0lFrHICQ"),
        Movie("Top Gun",
              "https://www.movieposter.com/posters/archive/main/15/A70-7600",
              "https://www.youtube.com/watch?v=qAfbp3YX9F0"),
        Movie("The Matrix",
              "https://www.movieposter.com/posters/archive/main/9/A70-4902",
              "https://www.youtube.com/watch?v=m8e-FF8MsqU"),
    ]
Ejemplo n.º 18
0
def split_movie_details(movie_details):
    """ Split movie details from the movie details list and return a single
        movie object """
    movie_obj = Movie(movie_details[1],  # movie title
                      movie_details[2],  # movie poster url
                      movie_details[3],  # youtube trailer url
                      movie_details[4],  # movie short info
                      movie_details[5])  # wiki url
    return movie_obj
Ejemplo n.º 19
0
def main():
    if type(sys.argv) and len(sys.argv) > 1:
        # an option is given
        option = sys.argv[1].strip()
        if option == "-sw":
            # switches database option. If enabled then creates a db file. Else deletes if any exists.
            if MMDB.movie_db_exists():
                # if already exists disable db options.
                delete = input(
                    "DB option is enabled (All the movies added will be lost). "
                    "Do you want to disable it and hence delete the db file? Press Y/N"
                )
                if delete.lower().startswith("y"):
                    #         user wants to continue to delete db
                    MMDB.delete_db()
            else:
                # enable db options.
                MMDB.save_movie_dict()
        elif option == "-a":
            print("Interactive mode!!! add your favourite movie to MMDB.")
            while True:
                title = input("Movie title: ")
                story = input("Story line: ")
                poster = input("URL to poster image: ")
                trailer = input("URL to youtube trailer: ")
                MMDB.movies[title] = Movie(title, story, poster, trailer)
                more = input(
                    "%s is added to MMDB. Do you want to add more? Press Y/N "
                    % (title))
                if more.lower().startswith("n"): break
            MMDB.save_movie_dict()
        #
        # elif option == "-e":
        #     # fixme have to add edit option
        #     print("Interactive mode!!! edit your favourite movie in the MMDB.")
        elif option == "-d":
            print("Interactive mode!!! delete your favourite movie from MMDB.")
            while True:
                print("ID: Movie Title")
                movie_titles = sorted(MMDB.movies.keys())
                for idx, title in enumerate(movie_titles):
                    print("%s : %s " % (idx + 1, title))
                # id of the movie to delete
                idx = eval(
                    input(
                        "Enter the id of the movie that you want to delete: "))
                if type(idx) == int and idx <= len(MMDB.movies):
                    MMDB.movies.pop(movie_titles[idx - 1])
                    more = input(
                        "%s is deleted from MMDB. Do you want to delete more? Press Y/N "
                        % (movie_titles[idx - 1]))
                    # exit interactive mode
                    if more.lower().startswith("n"): break

    # generate html code and display that to user.
    fresh_tomato.open_movies_page(MMDB.get_movies_as_list())
Ejemplo n.º 20
0
def main():
	forrest_gump = Movie('Forrest Gump', 'Depicts a life of a man',
		'https://upload.wikimedia.org/wikipedia/en/6/67/Forrest_Gump_poster.jpg',
		'https://www.youtube.com/watch?v=uPIEn0M8su0')

	avatar = Movie('Avatar', 'A man tries to save the planet Pandora',
		'https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg',
		'https://www.youtube.com/watch?v=5PSNL1qE6VY')

	shawshank = Movie('The Shawshank Redemption', 'A innocent banker tries to escape from prison',
		'https://upload.wikimedia.org/wikipedia/en/8/81/ShawshankRedemptionMoviePoster.jpg',
		'www.youtube.com/watch?v=6hB3S9bIaco')

	three_idiots = Movie('3 Idiots', 'Two friends are looking for a long-lost friend',
		'https://upload.wikimedia.org/wikipedia/en/d/df/3_idiots_poster.jpg',
		'www.youtube.com/watch?v=xvszmNXdM4w')

	movie_list = [forrest_gump, avatar, shawshank, three_idiots]
	open_movies_page(movie_list)
Ejemplo n.º 21
0
def get_movie_list():
    '''
    Fetch the movie list

    This currently fetches the movie list from a JSON file
    but can be updated later to fetch from a remote endpoint
    '''

    with open('movie_list.json', 'r') as json_file:
        return [Movie(**i) for i in json.load(json_file)]
def get_movies_from_json():
    with open('movies_list.json') as movies_file:
        data = json.load(movies_file)

    movies = []
    for movie_data in data["movies"]:
        m = Movie(movie_data["title"], movie_data["duration"],
                  movie_data["trailer_youtube_url"],
                  movie_data['poster_image_url'], movie_data['storyline'])
        movies.append(m)
    return movies
Ejemplo n.º 23
0
def main():
    hp1 = Movie(
        "Harry Potter 1",
        "https://images-na.ssl-images-amazon.com/images/I/51asM9eJMXL.jpg",
        "https://www.youtube.com/watch?v=VyHV0BRtdxo"
    )

    hp2 = Movie(
        "Harry Potter 2",
        "https://i.ytimg.com/vi/zX_PHrUTbLM/movieposter.jpg",
        "https://www.youtube.com/watch?v=1bq0qff4iF8"
    )

    hp3 = Movie(
        "Harry Potter 3",
        "https://cdn.europosters.eu/image/750/posters/harry-potter-3-forest-i621.jpg",  # noqa
        "https://www.youtube.com/watch?v=lAxgztbYDbs"
    )

    hp4 = Movie(
        "Harry Potter 4",
        "https://i.ytimg.com/vi/gPhXYeoCDlQ/movieposter.jpg",
        "https://www.youtube.com/watch?v=3EGojp4Hh6I"
    )

    hp5 = Movie(
        "Harry Potter 5",
        "https://i.ytimg.com/vi/Ak6vjFiZUqM/movieposter.jpg",
        "https://www.youtube.com/watch?v=y6ZW7KXaXYk"
    )

    hp6 = Movie(
        "Harry Potter 6",
        "https://i.ytimg.com/vi/TA7uBS2hfik/movieposter.jpg",
        "https://www.youtube.com/watch?v=jpCPvHJ6p90"
    )

    hp71 = Movie(
        "Harry Potter 7 pt.1",
        "https://imgc.allpostersimages.com/img/print/posters/harry-potter-7-part-2-one-sheet_a-G-8554781-0.jpg",  # noqa
        "https://www.youtube.com/watch?v=MxqsmsA8y5k"
    )

    hp72 = Movie(
        "Harry Potter 7 pt.2",
        "https://static.posters.cz/image/1300/plagaty/harry-potter-7-part-2-teaser-i11030.jpg",  # noqa
        "https://www.youtube.com/watch?v=VGBLczT_sLo"
    )

    # Open movie trailer page with list of provided movie instances
    open_movies_page([hp1, hp2, hp3, hp4, hp5, hp6, hp71, hp72])
Ejemplo n.º 24
0
def create_movies():
    """
    create movies objects
    then send them to open_movies_page function to create the html page
    """
    Movie(title="Big hero 6",
          image_url="http://www6.0zz0.com/2017/09/21/19/825878595.jpg",
          youtube_url="https://www.youtube.com/watch?v=z3biFxZIJOQ")
    Movie(title="frozen",
          image_url="http://www9.0zz0.com/2017/09/21/19/871522439.jpg",
          youtube_url="https://www.youtube.com/watch?v=TbQm5doF_Uc")
    Movie(title="Kimi no na Wa(your name)",
          image_url="http://www9.0zz0.com/2017/09/21/19/467915164.jpg",
          youtube_url="https://www.youtube.com/watch?v=hRfHcp2GjVI")
    Movie(title="A Silent Voice",
          image_url="http://www9.0zz0.com/2017/09/21/19/194459511.jpg",
          youtube_url="https://www.youtube.com/watch?v=nfK6UgLra7g")
    Movie(
        title="spirited away",
        image_url="http://www9.0zz0.com/2017/09/21/19/974860969.jpg",
        youtube_url="https://www.youtube.com/watch?v=ByXuk9QqQkk",
    )
    Movie(
        title="the wind Rises",
        image_url="http://www9.0zz0.com/2017/09/21/19/474969239.jpg",
        youtube_url="https://www.youtube.com/watch?v=2QFBZgAZx7g",
    )

    open_movies_page(Movie.movies)
Ejemplo n.º 25
0
def main():
    """
    Generate and serve a simple movie trailer website containing some of my
    favorite movies.
    :return: None
    """
    rocky = Movie('Rocky',
                  'https://i.imgur.com/xrJTWjZ.jpg',
                  'https://www.youtube.com/watch?v=3VUblDwa648')

    lethal_weapon = Movie('Lethal Weapon',
                          'https://i.imgur.com/ZIN7nQ2.jpg',
                          'https://www.youtube.com/watch?v=bKeW-MGu-qQ')

    apollo_13 = Movie('Apollo 13',
                      'https://i.imgur.com/7ZaAFsK.jpg',
                      'https://www.youtube.com/watch?v=KtEIMC58sZo')

    la_confidential = Movie('L.A. Confidential',
                            'https://i.imgur.com/4DHMZnZ.jpg',
                            'https://www.youtube.com/watch?v=6sOXrY5yV4g')

    inglourious_basterds = Movie('Inglourious Basterds',
                                 'https://i.imgur.com/Kzg3Ujp.jpg',
                                 'https://www.youtube.com/watch?v=KnrRy6kSFF0')

    moonrise_kingdom = Movie('Moonrise Kingdom',
                             'http://i.imgur.com/ALm2Ciu.jpg',
                             'https://www.youtube.com/watch?v=7N8wkVA4_8s')

    movies = [rocky, lethal_weapon, apollo_13, la_confidential,
              inglourious_basterds, moonrise_kingdom]

    open_movies_page(movies)
def get_movies(filename):
    """
    pulls movie data from csv and returns a list a Movie objects
    """
    movies = []
    with open(filename, 'r') as file:
        reader = csv.DictReader(file)
        for movie in reader:
            movies.append(
                Movie(title=movie['name'],
                      image_url=movie['image_url'],
                      youtube_url=movie['youtube_url']))
    return movies
Ejemplo n.º 27
0
def entertainment_center():
    movie_list = []
    movie1 = Movie("Captain America: Civil War", \
        "https://www.youtube.com/watch?v=QGfhS1hfTWw", \
        "http://t2.gstatic.com/images?q=tbn:ANd9GcQJHE0wTHT_pNRdZlnJj5IkzF49uMF3be1gfIIKw8A8z_3oHVRO", \
        "QGfhS1hfTWw")
    movie_list.append(movie1)

    movie2 = Movie("Neighbors 2: Sorority Rising", \
        "https://www.youtube.com/watch?v=h1pA4Oio6T8", \
        "http://t2.gstatic.com/images?q=tbn:ANd9GcST6cuzBZolESt6KVcg1aUzcFAOZU9CF4YA3OCZfHsdxeSQtbH9", \
        "h1pA4Oio6T8")

    movie_list.append(movie2)

    movie3 = Movie("That Awkward Moment", \
        "https://www.youtube.com/watch?v=wRcVgJjnFLo", \
        "http://t1.gstatic.com/images?q=tbn:ANd9GcTrFSWtS5G_u88IutD_Flen9789bPanDxf1JqUNvpxFJk5cVPyL", \
        "wRcVgJjnFLo")
    movie_list.append(movie3)

    return movie_list
    def __init__(self):
        # Create Movie instances from hard coded data
        m1 = Movie(
            imdb_id='tt0097958',
            trailer_youtube_url='https://www.youtube.com/watch?v=tLVd4ipC5Lc'
        )  # noqa
        m2 = Movie(
            imdb_id='tt0071853',
            trailer_youtube_url='https://www.youtube.com/watch?v=LG1PlkURjxE'
        )  # noqa
        m3 = Movie(
            imdb_id='tt0072431',
            trailer_youtube_url='https://www.youtube.com/watch?v=mOPTriLG5cU'
        )  # noqa
        m4 = Movie(
            imdb_id='BADIDTOTESTERRORCONDITION',
            trailer_youtube_url='https://www.youtube.com/watch?v=mOPTriLG5cU'
        )  # noqa
        self.movies = [m1, m2, m3, m4]

        # Load movie data from external source: omdb api
        self.__load_movie_data_from_omdb()
Ejemplo n.º 29
0
def get_mov_details(files):
    '''
    data is being pulled from csv creating list of objects of movie.
    '''
    movies = []
    with open(files, 'r') as file:
        reader = csv.DictReader(file)
        for movie in reader:
            movies.append(
                Movie(title=movie['name'],
                      image_url=movie['image_url'],
                      youtube_url=movie['youtube_url']))
    return movies
def create_movie(name=None, trailer=None, poster=None, overview=None):

    if name is None:
        name = input("Please enter a title: ")
    if trailer is None:
        trailer = input("Please enter the trailer url: ")
    if poster is None:
        poster = input("Please enter the poster image url: ")
    if overview is None:
        overview = input("Please enter a quick overview of the movie: ")

    movie = Movie(name, trailer, poster, overview)
    return movie