From 3b7280b37de54984ae2ac6aae2a1eac26fa45c8a Mon Sep 17 00:00:00 2001 From: blakperlz <36514136+blakperlz@users.noreply.github.com> Date: Fri, 16 Feb 2018 16:04:32 -0500 Subject: [PATCH] Completed Lesson One Check out the README file, especially that last line;) --- README.md | 41 ++++++++++++ entertainment_center2.py | 54 +++++++++++++++ fresh_tomatoes.html | 141 +++++++++++++++++++++++++++++++++++++++ fresh_tomatoes.py | 10 ++- fresh_tomatoes.pyc | Bin 0 -> 5522 bytes media2.py | 33 +++++++++ media2.pyc | Bin 0 -> 1868 bytes 7 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 entertainment_center2.py create mode 100644 fresh_tomatoes.html create mode 100644 fresh_tomatoes.pyc create mode 100644 media2.py create mode 100644 media2.pyc 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 0000000000000000000000000000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l0A=V}r6~Y4;4uJa;Izm-0Ym}L_k}{iVaY|3lmN8s zsK`fS)gh5JLLyYYA`(t2lU4$_{hxt^!jDW4Lquu=`~`hFe%aEM;!5F4@oHhU_;I0f ziA3e}`Z>MGwrv7g`%`*R;Av~MZ=f|7P`Ca|DAUSKYy)E)j>*wlx-|fH?Vx0o)=I^d GPyYq`XVa(v literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..d6f2d7cb46efc6e36f4a9a15d9fdc4f386047f41 GIT binary patch literal 1868 zcmb_c-)j>=5T45=X;WL3`dbn1MaYXv^+8Y(wZ$lCDBGeK3d{9wn_Rivmfejdkhco{ zv%dKU=zMc&DuOSiM|Lv1H#_sq%r_VRT3h+~{Kp`p`P1b8*S!1}7CHYSDv1UQJ)%KG zd4uv5%47OYbVBrX!22fUEy~-JFVV0`gP8JVG7UOl>(0WCjUw9VUSi+HZ+`lr#p>rG zH+F#_;*+<${4ExSW3vaA93p}r_N;cg4H!ITu{$b!!oM&wNl}fAGr{D^x6~EserbGi zU|o`yWs;St_r_;2-@$@|O>_Sxvhb!nP{>mOMweGD{03{A&-b>c zVPvZ(&-OmqZ-w!Dn;Y+nDlNC2Jv3REAC664q)#3lO~W$Z(z>XMp!E{#9^ol!MV+XN zaC3ty9UHB~3ZG~_w)v#Q78kV6ZKkz?@fjM?&Id`cBSLFET(+Zj6p(H&Am8nt$E)q$ z!;PnMtb_%UR>m*n!M(S<{0kQUumJR9el<^t))HPYx7wmG4VOe|gDEJEf5}3aA~Z;j z9M?5xcBIL1I!%I2Jh#pyW0X5_rc6PiqGIxlrR54- ztn%64K?02a32<>V7li8^!6R->?+#PE6J_8Q7Rn|~xXwx-I+T$@*#a$e>z`*B7T|0YP1?(TUu}Y E0WyV)l>h($ literal 0 HcmV?d00001