diff --git a/README.md b/README.md index 36ae53b62..3236bf3fe 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # ud036_StarterCode Source code for a Movie Trailer website. + +Purpose of this code is to create a webpage that will allow you to click on a picture and play youtube videos. + +There are 3 primary py files in this grouping: + media2.py = class formating module for the movies content + entertainment_center2.py = Execution and content module: listing of the movies, details about the movies, links and corresponding functions + fresh_tomatoes.py = webpage module. script that will launch the website with mark up language. Uses entertainment_center2 as the content module. + + +#media2.py + There is 1 parent class and 1 child class in this file. Intent is to make it modular for it can grow over time. + There are a total of 6 entries that are standardized across the group + 2 entries are inhereted from the 'Videos' object + 4 are unique to the 'Movies' object + Youtube is the source of choice when opening a trailer. I tried secondary sources but the play back would fail often. + wikimedia is the source of choice for images. I attempted several other sites and file formats, but hit many errors. + + +# Areas for improvment. +- Figure out why wikimedia is the only functioning source for images +- Figure out why youtube is the only functioning source for playing movies. + +#enterainment_center +- import media2 for class formatting +- import fresh_tomatoes for launching the webpage + +- list out your favorite movies and follow the formating from media2 file. +- 'movies' is a variable for an array of the favorite movies +- fresh_tomatoes.open_movies_page is the function launging the website. + +# Areas for improvement. +- this is fine for a small list, but a larger list should be in our sourced from a more comprehensive database. + +# fresh_tomatoes +Provided code from Udacity to launch the website. + +I made changes the to header by adding a little spanish lingo +Also added the details from entertainment_center.py to be included in the web page. This includes the inhereted instance variables which shows the code is working throughout the environment + + +Finally I wrote this README cause, you know...I'm having fun with this and want to practice how I plan to play:) diff --git a/entertainment_center2.py b/entertainment_center2.py new file mode 100644 index 000000000..7077bbf50 --- /dev/null +++ b/entertainment_center2.py @@ -0,0 +1,54 @@ +#media2 is the formating module for classes +import media2 +#fresh_tomatoes is the module to run the web page +import fresh_tomatoes + +toy_story = media2.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=4KPTXpQehio", + "160", + "4.5 of 5!" + ) +#print(toy_story.storyline) + +avatar = media2.Movie( + "Avatar", + "A marine on an alien planet fights and has alien sex", + #"https://ep01.epimg.net/cultura/imagenes/2017/04/23/actualidad/1492982810_329408_1492984569_noticia_normal_recorte1.jpg" + "https://upload.wikimedia.org/wikipedia/en/thumb/5/5c/Avatar_picture.jpg/220px-Avatar_picture.jpg", + #"https://zardra.deviantart.com/art/Feel-the-peace-Avatar-148548255", + #"http://james-camerons-avatar.wikia.com/wiki/File:Main_Wallpaper.png", + "http://www.youtube.com/watch?v=-9ceBgWV8io", + "150", + "4 of 5!" + ) +#print(avatar.poster_image_url) + +dirty_girl = media2.Movie ( + "Dirty Girl", + "A young girl who is stereotyped goes on a road trip with her overweight alternative lifesyle male friend to discover herself. Really its a movie about teenage stereo typyes.", + "https://media.npr.org/assets/img/2011/10/03/dg_d008_00183r_wide-ea07d599e9d17ee9820019a037a4e635d1e5a785-s900-c85.jpg", + #"https://youtu.be/Qy3eAiB5UPo" + "https://www.youtube.com/watch?v=3DylhbVj8DY", + "139", + "0.5 of 5!" + ) + +million_dolar = media2.Movie ( + "Million Dollar Baby", + "A young girl learns how to fight, kicks ass, and breaks her neck because Client Eastwood is slow and lazy", + "https://images-na.ssl-images-amazon.com/images/M/MV5BMTkxNzA1NDQxOV5BMl5BanBnXkFtZTcwNTkyMTIzMw@@._V1_UY1200_CR92,0,630,1200_AL_.jpg", + "https://www.youtube.com/watch?v=4B0zmj0-Iac", + "Not Enough", + "25 of 5!" + ) +#list of movies from above +movies = [toy_story, avatar, dirty_girl, million_dolar] +#fresh_tomatoes is the script running webpage +fresh_tomatoes.open_movies_page(movies) + + +#dirty_girl.show_trailer() +#dirty_girl.show_poster() diff --git a/fresh_tomatoes.html b/fresh_tomatoes.html new file mode 100644 index 000000000..08a249606 --- /dev/null +++ b/fresh_tomatoes.html @@ -0,0 +1,141 @@ + + + + + + Fresh Tomatoes! + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Toy Story

+
A story of a boy and his toys that come to life
+
160 Minutes long
+
4.5 of 5! Tomatoes
+
+ +
+ +

Avatar

+
A marine on an alien planet fights and has alien sex
+
150 Minutes long
+
4 of 5! Tomatoes
+
+ +
+ +

Dirty Girl

+
A young girl who is stereotyped goes on a road trip with her overweight alternative lifesyle male friend to discover herself. Really its a movie about teenage stereo typyes.
+
139 Minutes long
+
0.5 of 5! Tomatoes
+
+ +
+ +

Million Dollar Baby

+
A young girl learns how to fight, kicks ass, and breaks her neck because Client Eastwood is slow and lazy
+
Not Enough Minutes long
+
25 of 5! Tomatoes
+
+ +
+ + diff --git a/fresh_tomatoes.py b/fresh_tomatoes.py index 5cd75599c..63a6407f5 100644 --- a/fresh_tomatoes.py +++ b/fresh_tomatoes.py @@ -107,7 +107,7 @@ @@ -125,6 +125,9 @@

{movie_title}

+
{storyline}
+
{length} Minutes long
+
{rating} Tomatoes
''' @@ -145,7 +148,10 @@ def create_movie_tiles_content(movies): content += movie_tile_content.format( movie_title=movie.title, poster_image_url=movie.poster_image_url, - trailer_youtube_id=trailer_youtube_id + trailer_youtube_id=trailer_youtube_id, + length=movie.length, + rating=movie.rating, + storyline=movie.storyline ) return content diff --git a/fresh_tomatoes.pyc b/fresh_tomatoes.pyc new file mode 100644 index 000000000..124b9a90d Binary files /dev/null and b/fresh_tomatoes.pyc differ diff --git a/media2.py b/media2.py new file mode 100644 index 000000000..38871319d --- /dev/null +++ b/media2.py @@ -0,0 +1,33 @@ +import webbrowser +import fresh_tomatoes + +#This is the parent class in case we wanted to add a new sction like TV shows or something +class Video(): + """This is the inhereted variables for all classes""" + def __init__(self, length, rating): + print ("Duration and Rating Score Constructor") + self.length = length + self.rating = rating + +VALID_RATINGS = ["G", "PG", "PG-13", "R"] +#Added 'Video' as the partent so 'Movie' could inheret. +class Movie(Video): + """This class provides a way to store movie related information""" + VALID_RATINGS = ["G", "PG", "PG-13", "R"] + + def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube, length, rating): + print("Chiled contstructor movie") + self.title = movie_title + self.storyline = movie_storyline + self.poster_image_url = poster_image + self.trailer_youtube_url = trailer_youtube + Video.__init__(self, length, rating) + + def show_trailer(self): + webbrowser.open(self.trailer_youtube_url) + + def show_poster(self): + webbrowser.open(self.poster_image_url) + + + diff --git a/media2.pyc b/media2.pyc new file mode 100644 index 000000000..d6f2d7cb4 Binary files /dev/null and b/media2.pyc differ