Wednesday, August 3, 2016

IPND, stage 3, movie trailer, Python, JavaScript

Stage 3 gets you more practice on Python and some modules like webbrowser, turtle, os, time. And get familiar with Python class.
The project is cool, although it is kind of deceptive. Because the dirty work is actually done by JavaScript, which is already written for you. I may figure it out in another post.

project 3

html scripts are written and stored as string variables:
  • main_page_head: bootstrap is used as css and js. Track clicks and open movie trailer on youtube by javascript.
  • main_page_content: 4-level div
  • movie_tile_content
def create_movie_tiles_content(movies): use regular expression to search trailer_youtube_id and update the value in movie_tile_content.
def open_movies_page(movies): update main_page_content and write into “fresh_tomatoes.html”, use webbrowser to open the file.

define a Movie class, with attributes of title, storyline, poster_image_url, trailer_youtube_url

This is what the student is supposed to finish. The easiest part.
use media.Movie() to initialize 3 instances
To run it, put all python files in one directory, open terminal:
It then generates a html and opens it in a browser. If you click on the movie icon, it starts to play. It is pretty cool. However, github is not able to host a displayed HTML. Instead, I host it in my AWS: