Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# ud036_StarterCode
Source code for a Movie Trailer website.
Author: Joe Jordan
email: joewjordan -at- yahoo.com
Course: Full Stack web Development - Programming foundations with Python
Project: Final Project

Requirments-
Device runing Python 2.7


Installing -
download zip from repo: https://github.com/jpyces76/ud036_StarterCode
unpack into desired folder.

Running -
from command line: Python entertainment.py

from idle: open entertainment.py then -> Run -> Run module (F5)

45 changes: 45 additions & 0 deletions entertainment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import media
import fresh_tomatoes
""" This python script creates 6 movie instances into an array of movies
and supplies the list to fresh_tomatoes, which presents the movies in an
html page, that can be interacted with.

cmd line: Python entertainment.py"""


# create several instances of class movie
beetlejuice = media.Movie("Beetlejuice",
"Beetlejuice is the ghostus with the mostus",
"https://images-na.ssl-images-amazon.com/images/M/MV5BZDdmNjBlYTctNWU0MC00ODQxLWEzNDQtZGY1NmRhYjNmNDczXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SY1000_SX670_AL_.jpg",
"https://www.youtube.com/watch?v=2hovKm9oFiM")

potter = media.Movie("Harry Potter - Sorcerer's Stone",
"Magic boy finally gets cake",
"https://images-na.ssl-images-amazon.com/images/M/MV5BNjQ3NWNlNmQtMTE5ZS00MDdmLTlkZjUtZTBlM2UxMGFiMTU3XkEyXkFqcGdeQXVyNjUwNzk3NDc@._V1_.jpg",
"https://www.youtube.com/watch?v=K1KPcXRMMo4")

school = media.Movie("School of Rock",
"Rock music is fun to learn from",
"https://upload.wikimedia.org/wikipedia/en/1/11/School_of_Rock_Poster.jpg",
"https://www.youtube.com/watch?v=3PsUJFEBC74")

spawn = media.Movie("Spawn",
"A funny clown helps burn victims, but is misunderstood",
"https://images-na.ssl-images-amazon.com/images/M/MV5BN2ZkMWFlODEtNzIyOC00NmU2LTg5MDQtYWQxY2UyYmQxZGJlL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SY1000_CR0,0,678,1000_AL_.jpg",
"https://www.youtube.com/watch?v=5KMYx8lG59A")

labyrinth = media.Movie("Labyrinth",
"A girl trying to save her brother from the goblin king",
"https://images-na.ssl-images-amazon.com/images/M/MV5BMjM2MDE4OTQwOV5BMl5BanBnXkFtZTgwNjgxMTg2NzE@._V1_SY1000_CR0,0,648,1000_AL_.jpg",
"https://www.youtube.com/watch?v=_8ZmiqLiZbk")

btlc = media.Movie("Big trouble in little China",
"Rescue girl from evil chinese mob boss",
"http://www.theofficialjohncarpenter.com/wp-content/uploads/2016/01/john-carpenter-big-trouble-in-little-china-poster.jpg",
"https://www.youtube.com/watch?v=592EiTD2Hgo")

# create the list of movies for fresh_tomatoes
movies = [beetlejuice, school, spawn, labyrinth, btlc, potter]

# call launch tomatoes with list of movies created above.
fresh_tomatoes.open_movies_page(movies)
145 changes: 145 additions & 0 deletions fresh_tomatoes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Jordan's movie list!</title>

<!-- Bootstrap 3 -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<style type="text/css" media="screen">
body {
padding-top: 80px;
}
#trailer .modal-dialog {
margin-top: 200px;
width: 640px;
height: 480px;
}
.hanging-close {
position: absolute;
top: -12px;
right: -12px;
z-index: 9001;
}
#trailer-video {
width: 100%;
height: 100%;
}
.movie-tile {
margin-bottom: 20px;
padding-top: 20px;
}
.movie-tile:hover {
background-color: #EEE;
cursor: pointer;
}
.scale-media {
padding-bottom: 56.25%;
position: relative;
}
.scale-media iframe {
border: none;
height: 100%;
position: absolute;
width: 100%;
left: 0;
top: 0;
background-color: white;
}
</style>
<script type="text/javascript" charset="utf-8">
// Pause the video when the modal is closed
$(document).on('click', '.hanging-close, .modal-backdrop, .modal', function (event) {
// Remove the src so the player itself gets removed, as this is the only
// reliable way to ensure the video stops playing in IE
$("#trailer-video-container").empty();
});
// Start playing the video whenever the trailer modal is opened
$(document).on('click', '.movie-tile', function (event) {
var trailerYouTubeId = $(this).attr('data-trailer-youtube-id')
var sourceUrl = 'http://www.youtube.com/embed/' + trailerYouTubeId + '?autoplay=1&html5=1';
$("#trailer-video-container").empty().append($("<iframe></iframe>", {
'id': 'trailer-video',
'type': 'text-html',
'src': sourceUrl,
'frameborder': 0
}));
});
// Animate in the movies when the page loads
$(document).ready(function () {
$('.movie-tile').hide().first().show("fast", function showNext() {
$(this).next("div").show("fast", showNext);
});
});
</script>
</head>

<body>
<!-- Trailer Video Modal -->
<div class="modal" id="trailer">
<div class="modal-dialog">
<div class="modal-content">
<a href="#" class="hanging-close" data-dismiss="modal" aria-hidden="true">
<img src="https://lh5.ggpht.com/v4-628SilF0HtHuHdu5EzxD7WRqOrrTIDi_MhEG6_qkNtUK5Wg7KPkofp_VJoF7RS2LhxwEFCO1ICHZlc-o_=s0#w=24&h=24"/>
</a>
<div class="scale-media" id="trailer-video-container">
</div>
</div>
</div>
</div>

<!-- Main Page Content -->
<div class="container">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Jordan's List of Movie Trailers</a>
</div>
</div>
</div>
</div>
<div class="container">

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="2hovKm9oFiM" data-toggle="modal" data-target="#trailer">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BZDdmNjBlYTctNWU0MC00ODQxLWEzNDQtZGY1NmRhYjNmNDczXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SY1000_SX670_AL_.jpg" width="220" height="342">
<h2>Beetlejuice</h2>
<p>Beetlejuice is the ghostus with the mostus</p>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="3PsUJFEBC74" data-toggle="modal" data-target="#trailer">
<img src="https://upload.wikimedia.org/wikipedia/en/1/11/School_of_Rock_Poster.jpg" width="220" height="342">
<h2>School of Rock</h2>
<p>Rock music is fun to learn from</p>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="5KMYx8lG59A" data-toggle="modal" data-target="#trailer">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BN2ZkMWFlODEtNzIyOC00NmU2LTg5MDQtYWQxY2UyYmQxZGJlL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SY1000_CR0,0,678,1000_AL_.jpg" width="220" height="342">
<h2>Spawn</h2>
<p>A funny clown helps burn victims, but is misunderstood</p>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="_8ZmiqLiZbk" data-toggle="modal" data-target="#trailer">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjM2MDE4OTQwOV5BMl5BanBnXkFtZTgwNjgxMTg2NzE@._V1_SY1000_CR0,0,648,1000_AL_.jpg" width="220" height="342">
<h2>Labyrinth</h2>
<p>A girl trying to save her brother from the goblin king</p>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="592EiTD2Hgo" data-toggle="modal" data-target="#trailer">
<img src="http://www.theofficialjohncarpenter.com/wp-content/uploads/2016/01/john-carpenter-big-trouble-in-little-china-poster.jpg" width="220" height="342">
<h2>Big trouble in little China</h2>
<p>Rescue girl from evil chinese mob boss</p>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="K1KPcXRMMo4" data-toggle="modal" data-target="#trailer">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BNjQ3NWNlNmQtMTE5ZS00MDdmLTlkZjUtZTBlM2UxMGFiMTU3XkEyXkFqcGdeQXVyNjUwNzk3NDc@._V1_.jpg" width="220" height="342">
<h2>Harry Potter - Sorcerer's Stone</h2>
<p>Magic boy finally gets cake</p>
</div>

</div>
</body>
</html>
6 changes: 4 additions & 2 deletions fresh_tomatoes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fresh Tomatoes!</title>
<title>Jordan's movie list!</title>

<!-- Bootstrap 3 -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
Expand Down Expand Up @@ -107,7 +107,7 @@
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Fresh Tomatoes Movie Trailers</a>
<a class="navbar-brand" href="#">Jordan's List of Movie Trailers</a>
</div>
</div>
</div>
Expand All @@ -125,6 +125,7 @@
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="{trailer_youtube_id}" data-toggle="modal" data-target="#trailer">
<img src="{poster_image_url}" width="220" height="342">
<h2>{movie_title}</h2>
<p>{movie_desc}</p>
</div>
'''

Expand All @@ -144,6 +145,7 @@ def create_movie_tiles_content(movies):
# Append the tile for the movie with its content filled in
content += movie_tile_content.format(
movie_title=movie.title,
movie_desc = movie.storyline,
poster_image_url=movie.poster_image_url,
trailer_youtube_id=trailer_youtube_id
)
Expand Down
Binary file added fresh_tomatoes.pyc
Binary file not shown.
33 changes: 33 additions & 0 deletions media.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import webbrowser

class Movie() :
""" This a class of the type Movie
Params :
title - Title of the movie
storyline _ Brief synompsis of movie
poster image - Image the represents the movie
movie trailer - Movie trailer URL that can be played

To create an intance of movie (example)
avatar = media.Movie("Avatar",
"Blue people with bows and arrows",
"https://upload.wikimedia.org/wikipedia/id/b/b0/Avatar-Teaser-Poster.jpg",
"https://www.youtube.com/watch?v=cRdxXPV9GNQ")

"""
# list of current movie ratings from MPAA
VALID_RATINGS = ["G", "PG", "PG-13", "R", "NC-17"]

# Movie contstructor params defined in docs
def __init__(self, title, story, poster, trailer) :
self.title = title
self.storyline = story
self.poster_image_url = poster
self.trailer_youtube_url = trailer

# Movie method to play the movie trailer url
def show_trailer(self) :
webbrowser.open(self.trailer_youtube_url)



Binary file added media.pyc
Binary file not shown.
12 changes: 12 additions & 0 deletions name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import media


# print medias documentation
print(media.Movie.__doc__)

# print the module that contains Movie class
print(media.Movie.__module__)

# print the name of the class
print(media.Movie.__name__)