From 032872d765d87182cba0f1e7edaf4e0780a065c4 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 19:48:18 +0100 Subject: [PATCH 01/21] Project 1 files for Full Stack Nano Degress --- project1_die_hard/README.md | 2 + project1_die_hard/entertainment_centre.py | 26 ++++ project1_die_hard/fresh_tomatoes.py | 167 ++++++++++++++++++++++ project1_die_hard/media.py | 5 + 4 files changed, 200 insertions(+) create mode 100644 project1_die_hard/README.md create mode 100644 project1_die_hard/entertainment_centre.py create mode 100644 project1_die_hard/fresh_tomatoes.py create mode 100644 project1_die_hard/media.py diff --git a/project1_die_hard/README.md b/project1_die_hard/README.md new file mode 100644 index 000000000..36ae53b62 --- /dev/null +++ b/project1_die_hard/README.md @@ -0,0 +1,2 @@ +# ud036_StarterCode +Source code for a Movie Trailer website. diff --git a/project1_die_hard/entertainment_centre.py b/project1_die_hard/entertainment_centre.py new file mode 100644 index 000000000..cc7a136db --- /dev/null +++ b/project1_die_hard/entertainment_centre.py @@ -0,0 +1,26 @@ +### import classes from other files #### +import die_hard_movies +import media +### create list of movies ### +die_hard = media.Movie("Die Hard", + "http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg", + "https://www.youtube.com/watch?v=-qxBXm7ZUTM") + +die_hard_2 = media.Movie("Die Hard 2", + "https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg", + "https://www.youtube.com/watch?v=OyxfXQ4MGLQ") + +die_hard_3 = media.Movie("Die Hard with a Vengeance", + "https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg", + "https://www.youtube.com/watch?v=gQ0uSh2Hgcs") + +die_hard_4 = media.Movie("Live Free or Die Hard", + "https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg", + "https://www.youtube.com/watch?v=xqjICXgcsZM") + +die_hard_5 = media.Movie("A Good Day to Die Hard", + "http://screencrush.com/files/2012/12/die_hard_5_poster.jpg", + "https://www.youtube.com/watch?v=L1-_JtvbqRk") + +movies = [die_hard, die_hard_2, die_hard_3, die_hard_4, die_hard_5] +die_hard_movies.open_movies_page(movies) diff --git a/project1_die_hard/fresh_tomatoes.py b/project1_die_hard/fresh_tomatoes.py new file mode 100644 index 000000000..b8a00fd2a --- /dev/null +++ b/project1_die_hard/fresh_tomatoes.py @@ -0,0 +1,167 @@ +import webbrowser +import os +import re + + +# Styles and scripting for the page +main_page_head = ''' + + + + + Fresh Tomatoes! + + + + + + + + + +''' + + +# The main page layout and title bar +main_page_content = ''' + + + + + +
+ +
+
+ {movie_tiles} +
+ + +''' + + +# A single movie entry html template +movie_tile_content = ''' +
+ +

{movie_title}

+
+''' + + +def create_movie_tiles_content(movies): + # The HTML content for this section of the page + content = '' + for movie in movies: + # Extract the youtube ID from the url + youtube_id_match = re.search( + r'(?<=v=)[^&#]+', movie.trailer_youtube_url) + youtube_id_match = youtube_id_match or re.search( + r'(?<=be/)[^&#]+', movie.trailer_youtube_url) + trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match + else None) + + # Append the tile for the movie with its content filled in + content += movie_tile_content.format( + movie_title=movie.title, + poster_image_url=movie.poster_image_url, + trailer_youtube_id=trailer_youtube_id + ) + return content + + +def open_movies_page(movies): + # Create or overwrite the output file + output_file = open('die_hard_movies.html', 'w') + + # Replace the movie tiles placeholder generated content + rendered_content = main_page_content.format( + movie_tiles=create_movie_tiles_content(movies)) + + # Output the file + output_file.write(main_page_head + rendered_content) + output_file.close() + + # open the output file in the browser (in a new tab, if possible) + url = os.path.abspath(output_file.name) + webbrowser.open('file://' + url, new=2) diff --git a/project1_die_hard/media.py b/project1_die_hard/media.py new file mode 100644 index 000000000..b64aa8706 --- /dev/null +++ b/project1_die_hard/media.py @@ -0,0 +1,5 @@ +class Movie(): + def __init__(self, movie_title, poster_image_url, trailer_youtube_url): + self.title = movie_title + self.poster_image_url = poster_image_url + self.trailer_youtube_url = trailer_youtube_url From 3689e337d6e63065a73f31830abbed17cd346f17 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:00:46 +0100 Subject: [PATCH 02/21] Updated README --- README.md | 12 ++- die_hard_movies.html | 134 ++++++++++++++++++++++++++++++++ die_hard_movies.py | 167 ++++++++++++++++++++++++++++++++++++++++ die_hard_movies.pyc | Bin 0 -> 5403 bytes entertainment_centre.py | 26 +++++++ media.py | 5 ++ media.pyc | Bin 0 -> 656 bytes 7 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 die_hard_movies.html create mode 100644 die_hard_movies.py create mode 100644 die_hard_movies.pyc create mode 100644 entertainment_centre.py create mode 100644 media.py create mode 100644 media.pyc diff --git a/README.md b/README.md index 36ae53b62..76d866c25 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # ud036_StarterCode -Source code for a Movie Trailer website. + +Source code for a Movie Trailer website dedicated to the die hard series. + +FILES +die_hard_movies.py = py file to publish entertainment_centre movies +die_hard_movies.html = file for displaying movies +entertainment_centre = list of movie objects (die_hard films) +media = class for creating new die hard movies + +STEPS +1. RUN entertainment_centre.py to generate a die_hard_movies.html file diff --git a/die_hard_movies.html b/die_hard_movies.html new file mode 100644 index 000000000..795ac92cc --- /dev/null +++ b/die_hard_movies.html @@ -0,0 +1,134 @@ + + + + + + Fresh Tomatoes! + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Die Hard

+
+ +
+ +

Die Hard 2

+
+ +
+ +

Die Hard with a Vengeance

+
+ +
+ +

Live Free or Die Hard

+
+ +
+ +

A Good Day to Die Hard

+
+ +
+ + diff --git a/die_hard_movies.py b/die_hard_movies.py new file mode 100644 index 000000000..b8a00fd2a --- /dev/null +++ b/die_hard_movies.py @@ -0,0 +1,167 @@ +import webbrowser +import os +import re + + +# Styles and scripting for the page +main_page_head = ''' + + + + + Fresh Tomatoes! + + + + + + + + + +''' + + +# The main page layout and title bar +main_page_content = ''' + + + + + +
+ +
+
+ {movie_tiles} +
+ + +''' + + +# A single movie entry html template +movie_tile_content = ''' +
+ +

{movie_title}

+
+''' + + +def create_movie_tiles_content(movies): + # The HTML content for this section of the page + content = '' + for movie in movies: + # Extract the youtube ID from the url + youtube_id_match = re.search( + r'(?<=v=)[^&#]+', movie.trailer_youtube_url) + youtube_id_match = youtube_id_match or re.search( + r'(?<=be/)[^&#]+', movie.trailer_youtube_url) + trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match + else None) + + # Append the tile for the movie with its content filled in + content += movie_tile_content.format( + movie_title=movie.title, + poster_image_url=movie.poster_image_url, + trailer_youtube_id=trailer_youtube_id + ) + return content + + +def open_movies_page(movies): + # Create or overwrite the output file + output_file = open('die_hard_movies.html', 'w') + + # Replace the movie tiles placeholder generated content + rendered_content = main_page_content.format( + movie_tiles=create_movie_tiles_content(movies)) + + # Output the file + output_file.write(main_page_head + rendered_content) + output_file.close() + + # open the output file in the browser (in a new tab, if possible) + url = os.path.abspath(output_file.name) + webbrowser.open('file://' + url, new=2) diff --git a/die_hard_movies.pyc b/die_hard_movies.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3a2d9dd2bf3867db0d044e69e6764a89b0814fc GIT binary patch literal 5403 zcmcIoUvtyS6<^08kQ6SxZ5gJW>CB=~>H4l7yz5<6UC4(?UvRN3J&bC%iRIp&;Wf5wy*=B((( zd17)C;Z=EEoR);iqo`6A|xap+jS3GRM4T;Mde;-MELjM}XdCt7Uk zIm+GPceYNAxWXH{YKL!qZ25)@P?M0hA4;*XY!pgQd10`_t-cKXi4wU6w60dn+-w&$ zqy9Kq^o)`3OfPW6@ecoGtF@UkJ8cg0$a6%vAWy32W~=p!d@e1RsaYP$xx%(bo-h>* zy}&ZHY(G>g9PjYx%*K+se&B+%)hO`cB(;>Uu@QCMqI{P+XUDNFm5a z){&KD7US%sPU|Dd z`%Uc@ua!gaR+b1zA14l@tOKNjNnlev^13)8J_{ItRQm!*PsBogN96RTXIQtUf|#YRzDJE&@4;i@HnrLvmULnS^@* zf3jQRalLM2X)cLtL_we|FA%Y@(GcTE&FUMuhffM^=yag0Sk1YYEe<=xTJ9{1&aEFt zA`sul`gv;j-xfZyuv(I@Ux$+ylfHQ3@GiezClhWoET!Ul&9Rharc~xEoG6f)o>SW> z*@Rfha1z_%W$c4Tjka`bh12P@kxtTEp&0jt)2#8Erx(7-YhPFs*dB)OZr-38WxKms z%MD5X`(CzhSP{(S)Ir=yLLQrK+AwY{z>M=6wAtacOh+96wOb|iKtw^M$*^~tB;08d zU=$Q{Gn`_fvrm$4K-Vg*aI#T=$pU149e60V1VNGTqFpTcJVYaFD7YV5j+}EWMrVxL zZdT8OtsH09>$SpmQrl>_*s1Cpje!?Sg{O4GY26rDQo(X_Ce*tJL)6R6$Ug~o0va?N z?+6i5Vv)@(Xv=v~->jXNN1bL;p31*fQOu%5rQ#&bcvNn_NK1}y^d9?^>W;kZga}Ao zmXuvX2a~})2L(_vB`q1ja*-@8T;>F4kxSDdg;LgpX>1rd7fpwwSAv?9svlc{lO2=Rjr$Kh!5>?( z!=F+Km_c7II;3boa#z8;g_mNpAmC{g-szOnqk>arbw|pwgM%1FBZ5?)E#*IP_*^R* z7$u@PcFa4R8vfASN)lL7zS2p=v=K!xMG_iW8qT+xuJJDI?4_MO&pFA+!{Lw|lLmLP zTj6{`hu3VEPK}%g(L2;{Sh0t+IuyN0?1P&w*}6u%-GaIGIiqXb-fCxa-S+*t6>thZ zfxd0hTARVHKJ?<-85V>R`>*K61?HS*??KF} zcd`E4OY9YB59${n(jEkWbeC|ef6?h4bvOR-#~bV4-jtuEJ$=zkyF8*)Kfo<>KGaq} z#QUQ0)Q^ZV$*2Vn)yWu&zH-Dut>7Vr72B@*@fp-`0hD2kP8E?_Mr#k%xMrNK?u#A) z6Hw9224RdnQBTs}ANFaXI`PoMdX`l5B_x|gW4c=_kt3-GKDN7$y@l0rB{%sTt>#OK zWYCPlsqlTj`7kYbW%H$D*`As;2NU1#Nrlq38O7m9*lM%qc%p}|Ck~L2G%1Ri7#N!}PBhhY1HXp9A7>S?!K#EbSi zmAUG3yp56BdsNtD#@WY*EVfVZ(>|ZZI1DL5ZB9uURS)W;ibfv7oGcYt%GFrFX-&7O zGr&<$5!b2c_v3I1U)QOBUrR&4N3k1CRF6c~n2AwTidZNYZxs zEBbWQvZc$_)yn1S=aseUm5Pq?{hyN>Kc$;i=qk0Y(2YV;8*%>{TDjc1^=UAF0Sk4I aohLY@5-haP7lG`H2P?+P>PmI>%6|cm(Y_x5 literal 0 HcmV?d00001 diff --git a/entertainment_centre.py b/entertainment_centre.py new file mode 100644 index 000000000..cc7a136db --- /dev/null +++ b/entertainment_centre.py @@ -0,0 +1,26 @@ +### import classes from other files #### +import die_hard_movies +import media +### create list of movies ### +die_hard = media.Movie("Die Hard", + "http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg", + "https://www.youtube.com/watch?v=-qxBXm7ZUTM") + +die_hard_2 = media.Movie("Die Hard 2", + "https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg", + "https://www.youtube.com/watch?v=OyxfXQ4MGLQ") + +die_hard_3 = media.Movie("Die Hard with a Vengeance", + "https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg", + "https://www.youtube.com/watch?v=gQ0uSh2Hgcs") + +die_hard_4 = media.Movie("Live Free or Die Hard", + "https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg", + "https://www.youtube.com/watch?v=xqjICXgcsZM") + +die_hard_5 = media.Movie("A Good Day to Die Hard", + "http://screencrush.com/files/2012/12/die_hard_5_poster.jpg", + "https://www.youtube.com/watch?v=L1-_JtvbqRk") + +movies = [die_hard, die_hard_2, die_hard_3, die_hard_4, die_hard_5] +die_hard_movies.open_movies_page(movies) diff --git a/media.py b/media.py new file mode 100644 index 000000000..b64aa8706 --- /dev/null +++ b/media.py @@ -0,0 +1,5 @@ +class Movie(): + def __init__(self, movie_title, poster_image_url, trailer_youtube_url): + self.title = movie_title + self.poster_image_url = poster_image_url + self.trailer_youtube_url = trailer_youtube_url diff --git a/media.pyc b/media.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b00447557befa37f22215ea97a3020ac9dcd7d2b GIT binary patch literal 656 zcmcIhy-ve05WXZ(K@k#&fdz>*6Bau{2oM_`Qgvt+%fv1ioH~jxpi14~-FP2(0q$%B zF91otFZX|+lj3uC{C@N?Z{YhX=zT#5heVp50(1s%0IvY^n*1E5k_K6HYo$&psHyF3T9Wq*$F5{?*#Z)}LBqRzqWQkcY zeGr|0G0r)0?VF)BOAKPBRbz1_7K3v#plY5(*ZW7);HlI!_CfVpv_@NX(yefdMoDRx z7Nz7>VMGMkHr?q^sbHyEBPEVwb?f!u$gQ~cS5~zCP+Jw15Cs-C$|h+Q|Eie!zs>Qh MoTX!)^S(fUFSgK@N&o-= literal 0 HcmV?d00001 From b3f989ab2958d643a76eb86623a20674521018b4 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:20:19 +0100 Subject: [PATCH 03/21] Add files via upload --- project1_die_hard/README.md | 12 +- project1_die_hard/die_hard_movies.html | 134 ++++++++++++++++++++ project1_die_hard/die_hard_movies.py | 167 +++++++++++++++++++++++++ project1_die_hard/die_hard_movies.pyc | Bin 0 -> 5403 bytes project1_die_hard/media.pyc | Bin 0 -> 656 bytes 5 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 project1_die_hard/die_hard_movies.html create mode 100644 project1_die_hard/die_hard_movies.py create mode 100644 project1_die_hard/die_hard_movies.pyc create mode 100644 project1_die_hard/media.pyc diff --git a/project1_die_hard/README.md b/project1_die_hard/README.md index 36ae53b62..76d866c25 100644 --- a/project1_die_hard/README.md +++ b/project1_die_hard/README.md @@ -1,2 +1,12 @@ # ud036_StarterCode -Source code for a Movie Trailer website. + +Source code for a Movie Trailer website dedicated to the die hard series. + +FILES +die_hard_movies.py = py file to publish entertainment_centre movies +die_hard_movies.html = file for displaying movies +entertainment_centre = list of movie objects (die_hard films) +media = class for creating new die hard movies + +STEPS +1. RUN entertainment_centre.py to generate a die_hard_movies.html file diff --git a/project1_die_hard/die_hard_movies.html b/project1_die_hard/die_hard_movies.html new file mode 100644 index 000000000..795ac92cc --- /dev/null +++ b/project1_die_hard/die_hard_movies.html @@ -0,0 +1,134 @@ + + + + + + Fresh Tomatoes! + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Die Hard

+
+ +
+ +

Die Hard 2

+
+ +
+ +

Die Hard with a Vengeance

+
+ +
+ +

Live Free or Die Hard

+
+ +
+ +

A Good Day to Die Hard

+
+ +
+ + diff --git a/project1_die_hard/die_hard_movies.py b/project1_die_hard/die_hard_movies.py new file mode 100644 index 000000000..b8a00fd2a --- /dev/null +++ b/project1_die_hard/die_hard_movies.py @@ -0,0 +1,167 @@ +import webbrowser +import os +import re + + +# Styles and scripting for the page +main_page_head = ''' + + + + + Fresh Tomatoes! + + + + + + + + + +''' + + +# The main page layout and title bar +main_page_content = ''' + + + + + +
+ +
+
+ {movie_tiles} +
+ + +''' + + +# A single movie entry html template +movie_tile_content = ''' +
+ +

{movie_title}

+
+''' + + +def create_movie_tiles_content(movies): + # The HTML content for this section of the page + content = '' + for movie in movies: + # Extract the youtube ID from the url + youtube_id_match = re.search( + r'(?<=v=)[^&#]+', movie.trailer_youtube_url) + youtube_id_match = youtube_id_match or re.search( + r'(?<=be/)[^&#]+', movie.trailer_youtube_url) + trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match + else None) + + # Append the tile for the movie with its content filled in + content += movie_tile_content.format( + movie_title=movie.title, + poster_image_url=movie.poster_image_url, + trailer_youtube_id=trailer_youtube_id + ) + return content + + +def open_movies_page(movies): + # Create or overwrite the output file + output_file = open('die_hard_movies.html', 'w') + + # Replace the movie tiles placeholder generated content + rendered_content = main_page_content.format( + movie_tiles=create_movie_tiles_content(movies)) + + # Output the file + output_file.write(main_page_head + rendered_content) + output_file.close() + + # open the output file in the browser (in a new tab, if possible) + url = os.path.abspath(output_file.name) + webbrowser.open('file://' + url, new=2) diff --git a/project1_die_hard/die_hard_movies.pyc b/project1_die_hard/die_hard_movies.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3a2d9dd2bf3867db0d044e69e6764a89b0814fc GIT binary patch literal 5403 zcmcIoUvtyS6<^08kQ6SxZ5gJW>CB=~>H4l7yz5<6UC4(?UvRN3J&bC%iRIp&;Wf5wy*=B((( zd17)C;Z=EEoR);iqo`6A|xap+jS3GRM4T;Mde;-MELjM}XdCt7Uk zIm+GPceYNAxWXH{YKL!qZ25)@P?M0hA4;*XY!pgQd10`_t-cKXi4wU6w60dn+-w&$ zqy9Kq^o)`3OfPW6@ecoGtF@UkJ8cg0$a6%vAWy32W~=p!d@e1RsaYP$xx%(bo-h>* zy}&ZHY(G>g9PjYx%*K+se&B+%)hO`cB(;>Uu@QCMqI{P+XUDNFm5a z){&KD7US%sPU|Dd z`%Uc@ua!gaR+b1zA14l@tOKNjNnlev^13)8J_{ItRQm!*PsBogN96RTXIQtUf|#YRzDJE&@4;i@HnrLvmULnS^@* zf3jQRalLM2X)cLtL_we|FA%Y@(GcTE&FUMuhffM^=yag0Sk1YYEe<=xTJ9{1&aEFt zA`sul`gv;j-xfZyuv(I@Ux$+ylfHQ3@GiezClhWoET!Ul&9Rharc~xEoG6f)o>SW> z*@Rfha1z_%W$c4Tjka`bh12P@kxtTEp&0jt)2#8Erx(7-YhPFs*dB)OZr-38WxKms z%MD5X`(CzhSP{(S)Ir=yLLQrK+AwY{z>M=6wAtacOh+96wOb|iKtw^M$*^~tB;08d zU=$Q{Gn`_fvrm$4K-Vg*aI#T=$pU149e60V1VNGTqFpTcJVYaFD7YV5j+}EWMrVxL zZdT8OtsH09>$SpmQrl>_*s1Cpje!?Sg{O4GY26rDQo(X_Ce*tJL)6R6$Ug~o0va?N z?+6i5Vv)@(Xv=v~->jXNN1bL;p31*fQOu%5rQ#&bcvNn_NK1}y^d9?^>W;kZga}Ao zmXuvX2a~})2L(_vB`q1ja*-@8T;>F4kxSDdg;LgpX>1rd7fpwwSAv?9svlc{lO2=Rjr$Kh!5>?( z!=F+Km_c7II;3boa#z8;g_mNpAmC{g-szOnqk>arbw|pwgM%1FBZ5?)E#*IP_*^R* z7$u@PcFa4R8vfASN)lL7zS2p=v=K!xMG_iW8qT+xuJJDI?4_MO&pFA+!{Lw|lLmLP zTj6{`hu3VEPK}%g(L2;{Sh0t+IuyN0?1P&w*}6u%-GaIGIiqXb-fCxa-S+*t6>thZ zfxd0hTARVHKJ?<-85V>R`>*K61?HS*??KF} zcd`E4OY9YB59${n(jEkWbeC|ef6?h4bvOR-#~bV4-jtuEJ$=zkyF8*)Kfo<>KGaq} z#QUQ0)Q^ZV$*2Vn)yWu&zH-Dut>7Vr72B@*@fp-`0hD2kP8E?_Mr#k%xMrNK?u#A) z6Hw9224RdnQBTs}ANFaXI`PoMdX`l5B_x|gW4c=_kt3-GKDN7$y@l0rB{%sTt>#OK zWYCPlsqlTj`7kYbW%H$D*`As;2NU1#Nrlq38O7m9*lM%qc%p}|Ck~L2G%1Ri7#N!}PBhhY1HXp9A7>S?!K#EbSi zmAUG3yp56BdsNtD#@WY*EVfVZ(>|ZZI1DL5ZB9uURS)W;ibfv7oGcYt%GFrFX-&7O zGr&<$5!b2c_v3I1U)QOBUrR&4N3k1CRF6c~n2AwTidZNYZxs zEBbWQvZc$_)yn1S=aseUm5Pq?{hyN>Kc$;i=qk0Y(2YV;8*%>{TDjc1^=UAF0Sk4I aohLY@5-haP7lG`H2P?+P>PmI>%6|cm(Y_x5 literal 0 HcmV?d00001 diff --git a/project1_die_hard/media.pyc b/project1_die_hard/media.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b00447557befa37f22215ea97a3020ac9dcd7d2b GIT binary patch literal 656 zcmcIhy-ve05WXZ(K@k#&fdz>*6Bau{2oM_`Qgvt+%fv1ioH~jxpi14~-FP2(0q$%B zF91otFZX|+lj3uC{C@N?Z{YhX=zT#5heVp50(1s%0IvY^n*1E5k_K6HYo$&psHyF3T9Wq*$F5{?*#Z)}LBqRzqWQkcY zeGr|0G0r)0?VF)BOAKPBRbz1_7K3v#plY5(*ZW7);HlI!_CfVpv_@NX(yefdMoDRx z7Nz7>VMGMkHr?q^sbHyEBPEVwb?f!u$gQ~cS5~zCP+Jw15Cs-C$|h+Q|Eie!zs>Qh MoTX!)^S(fUFSgK@N&o-= literal 0 HcmV?d00001 From fb48f289b91feef6808749af8533ebea5af178bc Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:23:07 +0100 Subject: [PATCH 04/21] Delete README.md --- README.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 76d866c25..000000000 --- a/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# ud036_StarterCode - -Source code for a Movie Trailer website dedicated to the die hard series. - -FILES -die_hard_movies.py = py file to publish entertainment_centre movies -die_hard_movies.html = file for displaying movies -entertainment_centre = list of movie objects (die_hard films) -media = class for creating new die hard movies - -STEPS -1. RUN entertainment_centre.py to generate a die_hard_movies.html file From d202c114f60ae699d6143cd2b512ff795046ab24 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:23:19 +0100 Subject: [PATCH 05/21] Delete die_hard_movies.html --- die_hard_movies.html | 134 ------------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 die_hard_movies.html diff --git a/die_hard_movies.html b/die_hard_movies.html deleted file mode 100644 index 795ac92cc..000000000 --- a/die_hard_movies.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - Fresh Tomatoes! - - - - - - - - - - - - - - - -
- -
-
- -
- -

Die Hard

-
- -
- -

Die Hard 2

-
- -
- -

Die Hard with a Vengeance

-
- -
- -

Live Free or Die Hard

-
- -
- -

A Good Day to Die Hard

-
- -
- - From a239660a9015f6944c1f2168e6898edf05dc3f26 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:23:37 +0100 Subject: [PATCH 06/21] Delete die_hard_movies.py --- die_hard_movies.py | 167 --------------------------------------------- 1 file changed, 167 deletions(-) delete mode 100644 die_hard_movies.py diff --git a/die_hard_movies.py b/die_hard_movies.py deleted file mode 100644 index b8a00fd2a..000000000 --- a/die_hard_movies.py +++ /dev/null @@ -1,167 +0,0 @@ -import webbrowser -import os -import re - - -# Styles and scripting for the page -main_page_head = ''' - - - - - Fresh Tomatoes! - - - - - - - - - -''' - - -# The main page layout and title bar -main_page_content = ''' - - - - - -
- -
-
- {movie_tiles} -
- - -''' - - -# A single movie entry html template -movie_tile_content = ''' -
- -

{movie_title}

-
-''' - - -def create_movie_tiles_content(movies): - # The HTML content for this section of the page - content = '' - for movie in movies: - # Extract the youtube ID from the url - youtube_id_match = re.search( - r'(?<=v=)[^&#]+', movie.trailer_youtube_url) - youtube_id_match = youtube_id_match or re.search( - r'(?<=be/)[^&#]+', movie.trailer_youtube_url) - trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match - else None) - - # Append the tile for the movie with its content filled in - content += movie_tile_content.format( - movie_title=movie.title, - poster_image_url=movie.poster_image_url, - trailer_youtube_id=trailer_youtube_id - ) - return content - - -def open_movies_page(movies): - # Create or overwrite the output file - output_file = open('die_hard_movies.html', 'w') - - # Replace the movie tiles placeholder generated content - rendered_content = main_page_content.format( - movie_tiles=create_movie_tiles_content(movies)) - - # Output the file - output_file.write(main_page_head + rendered_content) - output_file.close() - - # open the output file in the browser (in a new tab, if possible) - url = os.path.abspath(output_file.name) - webbrowser.open('file://' + url, new=2) From 7014ec63718d5aff7b64f89b3b6411f69db4badc Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:23:50 +0100 Subject: [PATCH 07/21] Delete die_hard_movies.pyc --- die_hard_movies.pyc | Bin 5403 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 die_hard_movies.pyc diff --git a/die_hard_movies.pyc b/die_hard_movies.pyc deleted file mode 100644 index f3a2d9dd2bf3867db0d044e69e6764a89b0814fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5403 zcmcIoUvtyS6<^08kQ6SxZ5gJW>CB=~>H4l7yz5<6UC4(?UvRN3J&bC%iRIp&;Wf5wy*=B((( zd17)C;Z=EEoR);iqo`6A|xap+jS3GRM4T;Mde;-MELjM}XdCt7Uk zIm+GPceYNAxWXH{YKL!qZ25)@P?M0hA4;*XY!pgQd10`_t-cKXi4wU6w60dn+-w&$ zqy9Kq^o)`3OfPW6@ecoGtF@UkJ8cg0$a6%vAWy32W~=p!d@e1RsaYP$xx%(bo-h>* zy}&ZHY(G>g9PjYx%*K+se&B+%)hO`cB(;>Uu@QCMqI{P+XUDNFm5a z){&KD7US%sPU|Dd z`%Uc@ua!gaR+b1zA14l@tOKNjNnlev^13)8J_{ItRQm!*PsBogN96RTXIQtUf|#YRzDJE&@4;i@HnrLvmULnS^@* zf3jQRalLM2X)cLtL_we|FA%Y@(GcTE&FUMuhffM^=yag0Sk1YYEe<=xTJ9{1&aEFt zA`sul`gv;j-xfZyuv(I@Ux$+ylfHQ3@GiezClhWoET!Ul&9Rharc~xEoG6f)o>SW> z*@Rfha1z_%W$c4Tjka`bh12P@kxtTEp&0jt)2#8Erx(7-YhPFs*dB)OZr-38WxKms z%MD5X`(CzhSP{(S)Ir=yLLQrK+AwY{z>M=6wAtacOh+96wOb|iKtw^M$*^~tB;08d zU=$Q{Gn`_fvrm$4K-Vg*aI#T=$pU149e60V1VNGTqFpTcJVYaFD7YV5j+}EWMrVxL zZdT8OtsH09>$SpmQrl>_*s1Cpje!?Sg{O4GY26rDQo(X_Ce*tJL)6R6$Ug~o0va?N z?+6i5Vv)@(Xv=v~->jXNN1bL;p31*fQOu%5rQ#&bcvNn_NK1}y^d9?^>W;kZga}Ao zmXuvX2a~})2L(_vB`q1ja*-@8T;>F4kxSDdg;LgpX>1rd7fpwwSAv?9svlc{lO2=Rjr$Kh!5>?( z!=F+Km_c7II;3boa#z8;g_mNpAmC{g-szOnqk>arbw|pwgM%1FBZ5?)E#*IP_*^R* z7$u@PcFa4R8vfASN)lL7zS2p=v=K!xMG_iW8qT+xuJJDI?4_MO&pFA+!{Lw|lLmLP zTj6{`hu3VEPK}%g(L2;{Sh0t+IuyN0?1P&w*}6u%-GaIGIiqXb-fCxa-S+*t6>thZ zfxd0hTARVHKJ?<-85V>R`>*K61?HS*??KF} zcd`E4OY9YB59${n(jEkWbeC|ef6?h4bvOR-#~bV4-jtuEJ$=zkyF8*)Kfo<>KGaq} z#QUQ0)Q^ZV$*2Vn)yWu&zH-Dut>7Vr72B@*@fp-`0hD2kP8E?_Mr#k%xMrNK?u#A) z6Hw9224RdnQBTs}ANFaXI`PoMdX`l5B_x|gW4c=_kt3-GKDN7$y@l0rB{%sTt>#OK zWYCPlsqlTj`7kYbW%H$D*`As;2NU1#Nrlq38O7m9*lM%qc%p}|Ck~L2G%1Ri7#N!}PBhhY1HXp9A7>S?!K#EbSi zmAUG3yp56BdsNtD#@WY*EVfVZ(>|ZZI1DL5ZB9uURS)W;ibfv7oGcYt%GFrFX-&7O zGr&<$5!b2c_v3I1U)QOBUrR&4N3k1CRF6c~n2AwTidZNYZxs zEBbWQvZc$_)yn1S=aseUm5Pq?{hyN>Kc$;i=qk0Y(2YV;8*%>{TDjc1^=UAF0Sk4I aohLY@5-haP7lG`H2P?+P>PmI>%6|cm(Y_x5 From 7c34a857489dfc3a476f2837076dd33c2a7a3338 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:24:02 +0100 Subject: [PATCH 08/21] Delete entertainment_centre.py --- entertainment_centre.py | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 entertainment_centre.py diff --git a/entertainment_centre.py b/entertainment_centre.py deleted file mode 100644 index cc7a136db..000000000 --- a/entertainment_centre.py +++ /dev/null @@ -1,26 +0,0 @@ -### import classes from other files #### -import die_hard_movies -import media -### create list of movies ### -die_hard = media.Movie("Die Hard", - "http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg", - "https://www.youtube.com/watch?v=-qxBXm7ZUTM") - -die_hard_2 = media.Movie("Die Hard 2", - "https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg", - "https://www.youtube.com/watch?v=OyxfXQ4MGLQ") - -die_hard_3 = media.Movie("Die Hard with a Vengeance", - "https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg", - "https://www.youtube.com/watch?v=gQ0uSh2Hgcs") - -die_hard_4 = media.Movie("Live Free or Die Hard", - "https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg", - "https://www.youtube.com/watch?v=xqjICXgcsZM") - -die_hard_5 = media.Movie("A Good Day to Die Hard", - "http://screencrush.com/files/2012/12/die_hard_5_poster.jpg", - "https://www.youtube.com/watch?v=L1-_JtvbqRk") - -movies = [die_hard, die_hard_2, die_hard_3, die_hard_4, die_hard_5] -die_hard_movies.open_movies_page(movies) From e9752b20a5cdee487a56c73ab4936da19d5b9b74 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:24:13 +0100 Subject: [PATCH 09/21] Delete fresh_tomatoes.py --- fresh_tomatoes.py | 167 ---------------------------------------------- 1 file changed, 167 deletions(-) delete mode 100644 fresh_tomatoes.py diff --git a/fresh_tomatoes.py b/fresh_tomatoes.py deleted file mode 100644 index 5cd75599c..000000000 --- a/fresh_tomatoes.py +++ /dev/null @@ -1,167 +0,0 @@ -import webbrowser -import os -import re - - -# Styles and scripting for the page -main_page_head = ''' - - - - - Fresh Tomatoes! - - - - - - - - - -''' - - -# The main page layout and title bar -main_page_content = ''' - - - - - - -
- {movie_tiles} -
- - -''' - - -# A single movie entry html template -movie_tile_content = ''' -
- -

{movie_title}

-
-''' - - -def create_movie_tiles_content(movies): - # The HTML content for this section of the page - content = '' - for movie in movies: - # Extract the youtube ID from the url - youtube_id_match = re.search( - r'(?<=v=)[^&#]+', movie.trailer_youtube_url) - youtube_id_match = youtube_id_match or re.search( - r'(?<=be/)[^&#]+', movie.trailer_youtube_url) - trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match - else None) - - # Append the tile for the movie with its content filled in - content += movie_tile_content.format( - movie_title=movie.title, - poster_image_url=movie.poster_image_url, - trailer_youtube_id=trailer_youtube_id - ) - return content - - -def open_movies_page(movies): - # Create or overwrite the output file - output_file = open('fresh_tomatoes.html', 'w') - - # Replace the movie tiles placeholder generated content - rendered_content = main_page_content.format( - movie_tiles=create_movie_tiles_content(movies)) - - # Output the file - output_file.write(main_page_head + rendered_content) - output_file.close() - - # open the output file in the browser (in a new tab, if possible) - url = os.path.abspath(output_file.name) - webbrowser.open('file://' + url, new=2) From d2d74c5381f5fe7d486fba635a38b6eb667f609f Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:24:26 +0100 Subject: [PATCH 10/21] Delete media.py --- media.py | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 media.py diff --git a/media.py b/media.py deleted file mode 100644 index b64aa8706..000000000 --- a/media.py +++ /dev/null @@ -1,5 +0,0 @@ -class Movie(): - def __init__(self, movie_title, poster_image_url, trailer_youtube_url): - self.title = movie_title - self.poster_image_url = poster_image_url - self.trailer_youtube_url = trailer_youtube_url From 250ecaa11987c484d53711de49365181ee9e9449 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:24:34 +0100 Subject: [PATCH 11/21] Delete media.pyc --- media.pyc | Bin 656 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 media.pyc diff --git a/media.pyc b/media.pyc deleted file mode 100644 index b00447557befa37f22215ea97a3020ac9dcd7d2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 656 zcmcIhy-ve05WXZ(K@k#&fdz>*6Bau{2oM_`Qgvt+%fv1ioH~jxpi14~-FP2(0q$%B zF91otFZX|+lj3uC{C@N?Z{YhX=zT#5heVp50(1s%0IvY^n*1E5k_K6HYo$&psHyF3T9Wq*$F5{?*#Z)}LBqRzqWQkcY zeGr|0G0r)0?VF)BOAKPBRbz1_7K3v#plY5(*ZW7);HlI!_CfVpv_@NX(yefdMoDRx z7Nz7>VMGMkHr?q^sbHyEBPEVwb?f!u$gQ~cS5~zCP+Jw15Cs-C$|h+Q|Eie!zs>Qh MoTX!)^S(fUFSgK@N&o-= From 4e3c62f2b4dddec1fd96cc2b66743e2f870a9850 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:26:57 +0100 Subject: [PATCH 12/21] Add files via upload --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..f7d76ee3c --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# ud036_StarterCode + +Source code for a Movie Trailer website dedicated to the die hard series. + +Remaining files in Project1_die_hard folder + +FILES +die_hard_movies.py = py file to publish entertainment_centre movies, +die_hard_movies.html = file for displaying movies, +entertainment_centre = list of movie objects (die_hard films), +media = class for creating new die hard movies, + +STEPS +1. RUN entertainment_centre.py to generate a die_hard_movies.html file From 3a84c1d6c0a9c0ed82b51b8d7299cae29b727361 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Thu, 26 Oct 2017 20:27:12 +0100 Subject: [PATCH 13/21] Delete README.md --- project1_die_hard/README.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 project1_die_hard/README.md diff --git a/project1_die_hard/README.md b/project1_die_hard/README.md deleted file mode 100644 index 76d866c25..000000000 --- a/project1_die_hard/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# ud036_StarterCode - -Source code for a Movie Trailer website dedicated to the die hard series. - -FILES -die_hard_movies.py = py file to publish entertainment_centre movies -die_hard_movies.html = file for displaying movies -entertainment_centre = list of movie objects (die_hard films) -media = class for creating new die hard movies - -STEPS -1. RUN entertainment_centre.py to generate a die_hard_movies.html file From 3fc9f23816ea04fece77f1100ef8a70af5d8a509 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:24:21 +0100 Subject: [PATCH 14/21] Add files via upload --- README.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f7d76ee3c..94d7d863c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,21 @@ # ud036_StarterCode -Source code for a Movie Trailer website dedicated to the die hard series. +Source code for a Movie Trailer website dedicated to the Die Hard series. -Remaining files in Project1_die_hard folder +Remaining files in Project1_die_hard folder -FILES -die_hard_movies.py = py file to publish entertainment_centre movies, -die_hard_movies.html = file for displaying movies, -entertainment_centre = list of movie objects (die_hard films), -media = class for creating new die hard movies, +FILES +die_hard_movies.py = py file to publish entertainment_centre movies +die_hard_movies.html = file for displaying movies +entertainment_centre = list of movie objects (die_hard films) +media = class for creating new die hard movies -STEPS -1. RUN entertainment_centre.py to generate a die_hard_movies.html file +STEPS TO LAUNCH DIE HARD MOVIE TRAILERS +1. In terminal (on Mac) navigate to Project1_die_hard +2. Run entertainment_centre.py with cmd $ python entertainment_centre.py +3. This will generate die_hard_movies.html in your browser + +ADD NEW MOVIES +1. Open entertainment_centre +2. Create new object of Movie class +3. Add new object to 'movies' list From 964a726bf83296233c46d7cb5c803aadf0fe3366 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:25:19 +0100 Subject: [PATCH 15/21] Add files via upload --- project1_die_hard/die_hard_movies.html | 4 ++-- project1_die_hard/entertainment_centre.py | 28 +++++++++++++++-------- project1_die_hard/media.py | 8 +++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/project1_die_hard/die_hard_movies.html b/project1_die_hard/die_hard_movies.html index 795ac92cc..a52a60d6d 100644 --- a/project1_die_hard/die_hard_movies.html +++ b/project1_die_hard/die_hard_movies.html @@ -111,7 +111,7 @@

Die Hard

-

Die Hard 2

+

Die Harder

@@ -126,7 +126,7 @@

Live Free or Die Hard

-

A Good Day to Die Hard

+

A Good Day to Die Hard

diff --git a/project1_die_hard/entertainment_centre.py b/project1_die_hard/entertainment_centre.py index cc7a136db..8d50ee685 100644 --- a/project1_die_hard/entertainment_centre.py +++ b/project1_die_hard/entertainment_centre.py @@ -1,26 +1,34 @@ -### import classes from other files #### +# import classes from other files # import die_hard_movies import media -### create list of movies ### + +# create list of movies # die_hard = media.Movie("Die Hard", - "http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg", + ("http://horrornews.net/wp-content/uploads/" + "2016/09/Die-Hard-I-DVD.jpg"), "https://www.youtube.com/watch?v=-qxBXm7ZUTM") -die_hard_2 = media.Movie("Die Hard 2", - "https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg", +die_hard_2 = media.Movie("Die Harder", + ("https://images-na.ssl-images-amazon.com/images/M/" + "MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@" + "._V1_.jpg"), "https://www.youtube.com/watch?v=OyxfXQ4MGLQ") die_hard_3 = media.Movie("Die Hard with a Vengeance", - "https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg", + ("https://i.jeded.com/i/" + "die-hard-3-die-hard-with-a-vengeance.15819.jpg"), "https://www.youtube.com/watch?v=gQ0uSh2Hgcs") die_hard_4 = media.Movie("Live Free or Die Hard", - "https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg", + ("https://i.pinimg.com/originals/b1/97/90/" + "b197904bb75a1c3c9f55046083a94fa4.jpg"), "https://www.youtube.com/watch?v=xqjICXgcsZM") -die_hard_5 = media.Movie("A Good Day to Die Hard", - "http://screencrush.com/files/2012/12/die_hard_5_poster.jpg", +die_hard_5 = media.Movie("A Good Day \ + to Die Hard", + ("http://screencrush.com/files/2012/12/" + "die_hard_5_poster.jpg"), "https://www.youtube.com/watch?v=L1-_JtvbqRk") movies = [die_hard, die_hard_2, die_hard_3, die_hard_4, die_hard_5] -die_hard_movies.open_movies_page(movies) +'\n' + die_hard_movies.open_movies_page(movies) diff --git a/project1_die_hard/media.py b/project1_die_hard/media.py index b64aa8706..fa44ee388 100644 --- a/project1_die_hard/media.py +++ b/project1_die_hard/media.py @@ -1,5 +1,5 @@ class Movie(): - def __init__(self, movie_title, poster_image_url, trailer_youtube_url): - self.title = movie_title - self.poster_image_url = poster_image_url - self.trailer_youtube_url = trailer_youtube_url + def __init__(self, movie_title, poster_image_url, trailer_youtube_url): + self.title = movie_title + self.poster_image_url = poster_image_url + self.trailer_youtube_url = trailer_youtube_url From 90c066cb8a4b78138553c5d2888ffb291ad4f3d4 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:55:05 +0100 Subject: [PATCH 16/21] Add files via upload --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 94d7d863c..85ddd7f26 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,12 @@ entertainment_centre = list of movie objects (die_hard films) media = class for creating new die hard movies STEPS TO LAUNCH DIE HARD MOVIE TRAILERS -1. In terminal (on Mac) navigate to Project1_die_hard -2. Run entertainment_centre.py with cmd $ python entertainment_centre.py -3. This will generate die_hard_movies.html in your browser +1. Download the Project1_die_hard folder and save it to the desired location. +2. In terminal (on Mac) navigate to the file path for where you have saved Project1_die_hard +3. Run entertainment_centre.py with cmd $ python entertainment_centre.py +4. This will generate die_hard_movies.html in your browser +5. If you see an error when running entertainment_centre ensure python + is downloaded on your computer (google running python 2.7 on Mac) ADD NEW MOVIES 1. Open entertainment_centre From 37be3198a471cb04fa277f02b8a6f9c06a9f2332 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:55:34 +0100 Subject: [PATCH 17/21] Add files via upload --- project1_die_hard/entertainment_centre.py | 60 +++++++++++++---------- project1_die_hard/media.py | 2 + 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/project1_die_hard/entertainment_centre.py b/project1_die_hard/entertainment_centre.py index 8d50ee685..0a07d0fc3 100644 --- a/project1_die_hard/entertainment_centre.py +++ b/project1_die_hard/entertainment_centre.py @@ -2,33 +2,43 @@ import die_hard_movies import media -# create list of movies # -die_hard = media.Movie("Die Hard", - ("http://horrornews.net/wp-content/uploads/" - "2016/09/Die-Hard-I-DVD.jpg"), - "https://www.youtube.com/watch?v=-qxBXm7ZUTM") +# movie objects # +# Die Hard movie: movie title, poster image and movie trailer +die_hard = media.Movie( + "Die Hard", + "http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg", # NOQA + "https://www.youtube.com/watch?v=-qxBXm7ZUTM" + ) -die_hard_2 = media.Movie("Die Harder", - ("https://images-na.ssl-images-amazon.com/images/M/" - "MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@" - "._V1_.jpg"), - "https://www.youtube.com/watch?v=OyxfXQ4MGLQ") +# Die Harder movie: movie title, poster image and movie trailer +die_hard_2 = media.Movie( + "Die Harder", + "https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg", # NOQA + "https://www.youtube.com/watch?v=OyxfXQ4MGLQ" + ) -die_hard_3 = media.Movie("Die Hard with a Vengeance", - ("https://i.jeded.com/i/" - "die-hard-3-die-hard-with-a-vengeance.15819.jpg"), - "https://www.youtube.com/watch?v=gQ0uSh2Hgcs") +# Die Hard with a Vengeance movie: movie title, poster image and movie trailer +die_hard_3 = media.Movie( + "Die Hard with a Vengeance", + "https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg", # NOQA + "https://www.youtube.com/watch?v=gQ0uSh2Hgcs" + ) -die_hard_4 = media.Movie("Live Free or Die Hard", - ("https://i.pinimg.com/originals/b1/97/90/" - "b197904bb75a1c3c9f55046083a94fa4.jpg"), - "https://www.youtube.com/watch?v=xqjICXgcsZM") - -die_hard_5 = media.Movie("A Good Day \ - to Die Hard", - ("http://screencrush.com/files/2012/12/" - "die_hard_5_poster.jpg"), - "https://www.youtube.com/watch?v=L1-_JtvbqRk") +# Live Free of Die Hard movie: movie title, poster image and movie trailer +die_hard_4 = media.Movie( + "Live Free or Die Hard", + "https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg", # NOQA + "https://www.youtube.com/watch?v=xqjICXgcsZM" + ) +# A Good Day to Die Hard movie: movie title, poster image and movie trailer +die_hard_5 = media.Movie( + "A Good Day to Die Hard", + "http://screencrush.com/files/2012/12/die_hard_5_poster.jpg", # NOQA + "https://www.youtube.com/watch?v=L1-_JtvbqRk" + ) +# list of movies # movies = [die_hard, die_hard_2, die_hard_3, die_hard_4, die_hard_5] -'\n' + die_hard_movies.open_movies_page(movies) + +# calls open_movies_page to generate die_hard_movies.htlm file +die_hard_movies.open_movies_page(movies) diff --git a/project1_die_hard/media.py b/project1_die_hard/media.py index fa44ee388..b93a85917 100644 --- a/project1_die_hard/media.py +++ b/project1_die_hard/media.py @@ -1,5 +1,7 @@ +# class to create a new movie entry with movie title, poster_image_url, and trailer_youtube_url # class Movie(): def __init__(self, movie_title, poster_image_url, trailer_youtube_url): + """ This docstring explains the constructor method """ self.title = movie_title self.poster_image_url = poster_image_url self.trailer_youtube_url = trailer_youtube_url From 762a8c47ce134c36fa8ade43b3539942d2bacf60 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:55:50 +0100 Subject: [PATCH 18/21] Delete die_hard_movies.pyc --- project1_die_hard/die_hard_movies.pyc | Bin 5403 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 project1_die_hard/die_hard_movies.pyc diff --git a/project1_die_hard/die_hard_movies.pyc b/project1_die_hard/die_hard_movies.pyc deleted file mode 100644 index f3a2d9dd2bf3867db0d044e69e6764a89b0814fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5403 zcmcIoUvtyS6<^08kQ6SxZ5gJW>CB=~>H4l7yz5<6UC4(?UvRN3J&bC%iRIp&;Wf5wy*=B((( zd17)C;Z=EEoR);iqo`6A|xap+jS3GRM4T;Mde;-MELjM}XdCt7Uk zIm+GPceYNAxWXH{YKL!qZ25)@P?M0hA4;*XY!pgQd10`_t-cKXi4wU6w60dn+-w&$ zqy9Kq^o)`3OfPW6@ecoGtF@UkJ8cg0$a6%vAWy32W~=p!d@e1RsaYP$xx%(bo-h>* zy}&ZHY(G>g9PjYx%*K+se&B+%)hO`cB(;>Uu@QCMqI{P+XUDNFm5a z){&KD7US%sPU|Dd z`%Uc@ua!gaR+b1zA14l@tOKNjNnlev^13)8J_{ItRQm!*PsBogN96RTXIQtUf|#YRzDJE&@4;i@HnrLvmULnS^@* zf3jQRalLM2X)cLtL_we|FA%Y@(GcTE&FUMuhffM^=yag0Sk1YYEe<=xTJ9{1&aEFt zA`sul`gv;j-xfZyuv(I@Ux$+ylfHQ3@GiezClhWoET!Ul&9Rharc~xEoG6f)o>SW> z*@Rfha1z_%W$c4Tjka`bh12P@kxtTEp&0jt)2#8Erx(7-YhPFs*dB)OZr-38WxKms z%MD5X`(CzhSP{(S)Ir=yLLQrK+AwY{z>M=6wAtacOh+96wOb|iKtw^M$*^~tB;08d zU=$Q{Gn`_fvrm$4K-Vg*aI#T=$pU149e60V1VNGTqFpTcJVYaFD7YV5j+}EWMrVxL zZdT8OtsH09>$SpmQrl>_*s1Cpje!?Sg{O4GY26rDQo(X_Ce*tJL)6R6$Ug~o0va?N z?+6i5Vv)@(Xv=v~->jXNN1bL;p31*fQOu%5rQ#&bcvNn_NK1}y^d9?^>W;kZga}Ao zmXuvX2a~})2L(_vB`q1ja*-@8T;>F4kxSDdg;LgpX>1rd7fpwwSAv?9svlc{lO2=Rjr$Kh!5>?( z!=F+Km_c7II;3boa#z8;g_mNpAmC{g-szOnqk>arbw|pwgM%1FBZ5?)E#*IP_*^R* z7$u@PcFa4R8vfASN)lL7zS2p=v=K!xMG_iW8qT+xuJJDI?4_MO&pFA+!{Lw|lLmLP zTj6{`hu3VEPK}%g(L2;{Sh0t+IuyN0?1P&w*}6u%-GaIGIiqXb-fCxa-S+*t6>thZ zfxd0hTARVHKJ?<-85V>R`>*K61?HS*??KF} zcd`E4OY9YB59${n(jEkWbeC|ef6?h4bvOR-#~bV4-jtuEJ$=zkyF8*)Kfo<>KGaq} z#QUQ0)Q^ZV$*2Vn)yWu&zH-Dut>7Vr72B@*@fp-`0hD2kP8E?_Mr#k%xMrNK?u#A) z6Hw9224RdnQBTs}ANFaXI`PoMdX`l5B_x|gW4c=_kt3-GKDN7$y@l0rB{%sTt>#OK zWYCPlsqlTj`7kYbW%H$D*`As;2NU1#Nrlq38O7m9*lM%qc%p}|Ck~L2G%1Ri7#N!}PBhhY1HXp9A7>S?!K#EbSi zmAUG3yp56BdsNtD#@WY*EVfVZ(>|ZZI1DL5ZB9uURS)W;ibfv7oGcYt%GFrFX-&7O zGr&<$5!b2c_v3I1U)QOBUrR&4N3k1CRF6c~n2AwTidZNYZxs zEBbWQvZc$_)yn1S=aseUm5Pq?{hyN>Kc$;i=qk0Y(2YV;8*%>{TDjc1^=UAF0Sk4I aohLY@5-haP7lG`H2P?+P>PmI>%6|cm(Y_x5 From 84ec2cf897ced63678317e60c294a52599a82d1f Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:55:59 +0100 Subject: [PATCH 19/21] Delete media.pyc --- project1_die_hard/media.pyc | Bin 656 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 project1_die_hard/media.pyc diff --git a/project1_die_hard/media.pyc b/project1_die_hard/media.pyc deleted file mode 100644 index b00447557befa37f22215ea97a3020ac9dcd7d2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 656 zcmcIhy-ve05WXZ(K@k#&fdz>*6Bau{2oM_`Qgvt+%fv1ioH~jxpi14~-FP2(0q$%B zF91otFZX|+lj3uC{C@N?Z{YhX=zT#5heVp50(1s%0IvY^n*1E5k_K6HYo$&psHyF3T9Wq*$F5{?*#Z)}LBqRzqWQkcY zeGr|0G0r)0?VF)BOAKPBRbz1_7K3v#plY5(*ZW7);HlI!_CfVpv_@NX(yefdMoDRx z7Nz7>VMGMkHr?q^sbHyEBPEVwb?f!u$gQ~cS5~zCP+Jw15Cs-C$|h+Q|Eie!zs>Qh MoTX!)^S(fUFSgK@N&o-= From a2f4152779d5047670530bf32b8f82c753e94402 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 10:56:48 +0100 Subject: [PATCH 20/21] Delete fresh_tomatoes.py --- project1_die_hard/fresh_tomatoes.py | 167 ---------------------------- 1 file changed, 167 deletions(-) delete mode 100644 project1_die_hard/fresh_tomatoes.py diff --git a/project1_die_hard/fresh_tomatoes.py b/project1_die_hard/fresh_tomatoes.py deleted file mode 100644 index b8a00fd2a..000000000 --- a/project1_die_hard/fresh_tomatoes.py +++ /dev/null @@ -1,167 +0,0 @@ -import webbrowser -import os -import re - - -# Styles and scripting for the page -main_page_head = ''' - - - - - Fresh Tomatoes! - - - - - - - - - -''' - - -# The main page layout and title bar -main_page_content = ''' - - - - - -
- -
-
- {movie_tiles} -
- - -''' - - -# A single movie entry html template -movie_tile_content = ''' -
- -

{movie_title}

-
-''' - - -def create_movie_tiles_content(movies): - # The HTML content for this section of the page - content = '' - for movie in movies: - # Extract the youtube ID from the url - youtube_id_match = re.search( - r'(?<=v=)[^&#]+', movie.trailer_youtube_url) - youtube_id_match = youtube_id_match or re.search( - r'(?<=be/)[^&#]+', movie.trailer_youtube_url) - trailer_youtube_id = (youtube_id_match.group(0) if youtube_id_match - else None) - - # Append the tile for the movie with its content filled in - content += movie_tile_content.format( - movie_title=movie.title, - poster_image_url=movie.poster_image_url, - trailer_youtube_id=trailer_youtube_id - ) - return content - - -def open_movies_page(movies): - # Create or overwrite the output file - output_file = open('die_hard_movies.html', 'w') - - # Replace the movie tiles placeholder generated content - rendered_content = main_page_content.format( - movie_tiles=create_movie_tiles_content(movies)) - - # Output the file - output_file.write(main_page_head + rendered_content) - output_file.close() - - # open the output file in the browser (in a new tab, if possible) - url = os.path.abspath(output_file.name) - webbrowser.open('file://' + url, new=2) From ed64a99a89c1af4c3a3df4a460a5e0f028906403 Mon Sep 17 00:00:00 2001 From: louisorluigi Date: Fri, 27 Oct 2017 15:11:55 +0100 Subject: [PATCH 21/21] Add files via upload --- project1_die_hard/media.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project1_die_hard/media.py b/project1_die_hard/media.py index b93a85917..f05d15605 100644 --- a/project1_die_hard/media.py +++ b/project1_die_hard/media.py @@ -1,4 +1,7 @@ -# class to create a new movie entry with movie title, poster_image_url, and trailer_youtube_url # +# class to create a new movie entry with movie title, +# poster_image_url, and trailer_youtube_url + + class Movie(): def __init__(self, movie_title, poster_image_url, trailer_youtube_url): """ This docstring explains the constructor method """