diff --git a/README.md b/README.md index 36ae53b6..2ddc2f8b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,32 @@ -# ud036_StarterCode -Source code for a Movie Trailer website. +# Movie Trailer website + +This is a project to let user to create a Movie Trailer website. + +## Guidelines + +Install [Python](https://www.python.org/)(if you don't have one). + +Download or clone this repository. + +Edit **entertainment_center.py** with the editor you likeļ¼š +* Create your Movie object like the following example: + +``` +toy_story = media.Movie("Toy Story", // title + "A story of a boy and his toys that come to life", // story line + "https://upload.wikimedia.com/200px-ToyStory4poster.jpg", // poster image URL + "https://youtu.be/Bj4gS1JQzjk" //trailer URL ) // trailer URL +``` +* Store those Movie object in a list like the following example: +``` +movies = [toy_story, avatar, warcraft] +``` +* Call open_movies_page() function to take in your list of movies and generate an HTML file including this content, and produce website to showcase your favorite movies. +``` +fresh_tomatoes.open_movies_page(movies) +``` +* Build entertainment_center.py with python. + +## License + +The content of this repository is licensed under a [MIT License](https://choosealicense.com/licenses/mit/) diff --git a/entertainment_center.py b/entertainment_center.py new file mode 100644 index 00000000..a924cd90 --- /dev/null +++ b/entertainment_center.py @@ -0,0 +1,37 @@ +''' +Project_name: movie_website +Author: Yuhan Lin +Description: This is a main fuction. + Allow user to create instances of Movie. + And use open_movies_page(movies) to create movie website +Last_update:4/18/2017 +''' +import media +import fresh_tomatoes + +# create instances of Movie +toy_story = media.Movie("Toy Story", + "A story of a boy and his toys that come to life", + "https://upload.wikimedia.org/wikipedia/en/thumb/f/f9/" + "ToyStory4poster.jpg/200px-ToyStory4poster.jpg", + "https://youtu.be/Bj4gS1JQzjk") + +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://youtu.be/H9S-K71JD_E") + +warcraft = media.Movie("Warcraft", + "Draenor, the homeworld of the orcs, is being torn" + "apart by a mysterious force known as fel magic.", + "https://upload.wikimedia.org/wikipedia/en/thumb/5/" + "56/Warcraft_Teaser_Poster.jpg/" + "220px-Warcraft_Teaser_Poster.jpg", + "https://youtu.be/RhFMIRuHAL4") + +# create a list to store the movies +movies = [toy_story, avatar, warcraft] + +# use open_movies_page(movies) to create movie website +fresh_tomatoes.open_movies_page(movies) diff --git a/fresh_tomatoes.html b/fresh_tomatoes.html new file mode 100644 index 00000000..4f2ca120 --- /dev/null +++ b/fresh_tomatoes.html @@ -0,0 +1,124 @@ + + + + + + Fresh Tomatoes! + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Toy Story

+
+ +
+ +

Avatar

+
+ +
+ +

Warcraft

+
+ +
+ + diff --git a/fresh_tomatoes.pyc b/fresh_tomatoes.pyc new file mode 100644 index 00000000..52425d70 Binary files /dev/null and b/fresh_tomatoes.pyc differ diff --git a/media.py b/media.py new file mode 100644 index 00000000..7ee7a21b --- /dev/null +++ b/media.py @@ -0,0 +1,28 @@ +''' +Project_name: movie_website +Author: Yuhan Lin +Description: this is a Movie class. Allow user to create instances of Movie. +Last_update:4/18/2017 +''' + +import webbrowser + + +class Movie(): + """ this is a Movie class. Allow user to create instances of Movie. """ + def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube): + """ + Args: + param1(str): movie_title. + param2(str): movie_storyline. + param3(str): poster_image URL. + param4(str): movie_storyline URL. + """ + self.title = movie_title + self.storyline = movie_storyline + self.poster_image_url = poster_image + self.trailer_youtube_url = trailer_youtube + + def show_trailer(self): + """ open browser to load the URL """ + webbrowser.open(self.trailer_youtube_url) \ No newline at end of file diff --git a/media.pyc b/media.pyc new file mode 100644 index 00000000..70b766a1 Binary files /dev/null and b/media.pyc differ