Example #1
0
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)
avatar = media.Movie(
    "Avatar",
    "An epic science fiction Movie which showed alien life on pandora",
    "https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg",
    "https://www.youtube.com/watch?v=5PSNL1qE6VY")

avengers = media.Movie(
    "Avengers",
    "A superhero movie based on Marvels comics",
    "https://upload.wikimedia.org/wikipedia/en/f/f9/TheAvengers2012Poster.jpg",
    "https://www.youtube.com/watch?v=eOrNdBpGMv8")

the_proposal = media.Movie(
    "The Proposal",
    "Here comes the bride",
    "https://upload.wikimedia.org/wikipedia/en/0/02/The_Proposal.jpg",
    "https://www.youtube.com/watch?v=RFL8b1p1ELY")

titanic = media.Movie(
    "Titanic",
    "Story of Love",
    "https://upload.wikimedia.org/wikipedia/en/2/22/Titanic_poster.jpg",
    "https://www.youtube.com/watch?v=2e-eXJ6HgkQ")

# Creating the array of movie data
movies = [batman_begins, dark_knight, dark_knight_rises, toy_story, avatar,
          avengers, the_proposal, titanic]
# Creating the web page
fresh_tomatoes.create_movie_tiles_content(movies)
fresh_tomatoes.open_movies_page(movies)
movies.append(media.Movie(
    "Top Gun",
    "http://40.media.tumblr.com/52ecb6d4ea9c404bf51f8602124bf285/tumblr_np6t8jHh3C1uwq4qxo1_500.jpg",  # noqa
    "www.youtube.com/watch?v=VN8ze3S0Uj8"))

movies.append(media.Movie(
    "The Blues Brothers",
    "http://s35.podbean.com/pb/0c35164e351e5177413d83203a57af58/55f5fe6c/data1/blogs24/97450/uploads/blues-brothers-the-mission-from-god.jpg",  # noqa
    "www.youtube.com/watch?v=A-xtJYIwfYo"))

movies.append(media.Movie(
    "Forrest Gump",
    "http://enr.expertcomics.com/images/enr-archives/uploads/2012/11/Forrest-Gump-poster.jpg",  # noqa
    "www.youtube.com/watch?v=eYSnxZKTZzU"))

movies.append(media.Movie(
    "Love Actually",
    "http://d3dvedx3sqrauf.cloudfront.net/i/boxart/zoom/67/60/828765676021.jpg",  # noqa
    "www.youtube.com/watch?v=cYCkFTyADJ0"))

movies.append(media.Movie(
    "Play 'Em Off",
    "http://api.ning.com/files/fRQr8hF1hzOeZMMYwLm632OmoSagRPvVmiZECZTncNtwLX3XZfQF*LBWJykltpwkoOmCk68ROpFHmL*cCf0j7cScrOUL7Y8s/373e104646104437063c99589b485d9b.jpg",  # noqa
    "https://www.youtube.com/watch?v=O2ulyJuvU3Q"))

# generate html file
fresh_tomatoes.create_movie_tiles_content(movies)

# open html file
fresh_tomatoes.open_movies_page(movies)
def main():
  generate_movie_list()
  fresh_tomatoes.create_movie_tiles_content(movies)
  fresh_tomatoes.open_movies_page(movies)
Example #5
0
import entertainment_center, fresh_tomatoes

#create a movie website in HTML
fresh_tomatoes.create_movie_tiles_content(entertainment_center.movies)
#open the movie website
fresh_tomatoes.open_movies_page(entertainment_center.movies)