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
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# ud036_StarterCode
Source code for a Movie Trailer website.

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 TO LAUNCH DIE HARD MOVIE TRAILERS
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
2. Create new object of Movie class
3. Add new object to 'movies' list
134 changes: 134 additions & 0 deletions project1_die_hard/die_hard_movies.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fresh Tomatoes!</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="#">Die Hard 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="-qxBXm7ZUTM" data-toggle="modal" data-target="#trailer">
<img src="http://horrornews.net/wp-content/uploads/2016/09/Die-Hard-I-DVD.jpg" width="220" height="342">
<h2>Die Hard</h2>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="OyxfXQ4MGLQ" data-toggle="modal" data-target="#trailer">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BNzM1MzMwNzY2OF5BMl5BanBnXkFtZTgwNzE1MzkyMTE@._V1_.jpg" width="220" height="342">
<h2>Die Harder</h2>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="gQ0uSh2Hgcs" data-toggle="modal" data-target="#trailer">
<img src="https://i.jeded.com/i/die-hard-3-die-hard-with-a-vengeance.15819.jpg" width="220" height="342">
<h2>Die Hard with a Vengeance</h2>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="xqjICXgcsZM" data-toggle="modal" data-target="#trailer">
<img src="https://i.pinimg.com/originals/b1/97/90/b197904bb75a1c3c9f55046083a94fa4.jpg" width="220" height="342">
<h2>Live Free or Die Hard</h2>
</div>

<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="L1-_JtvbqRk" data-toggle="modal" data-target="#trailer">
<img src="http://screencrush.com/files/2012/12/die_hard_5_poster.jpg" width="220" height="342">
<h2>A Good Day to Die Hard</h2>
</div>

</div>
</body>
</html>
4 changes: 2 additions & 2 deletions fresh_tomatoes.py → project1_die_hard/die_hard_movies.py
Original file line number Diff line number Diff line change
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="#">Die Hard Movie Trailers</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -152,7 +152,7 @@ def create_movie_tiles_content(movies):

def open_movies_page(movies):
# Create or overwrite the output file
output_file = open('fresh_tomatoes.html', 'w')
output_file = open('die_hard_movies.html', 'w')

# Replace the movie tiles placeholder generated content
rendered_content = main_page_content.format(
Expand Down
44 changes: 44 additions & 0 deletions project1_die_hard/entertainment_centre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# import classes from other files #
import die_hard_movies
import media

# 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 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 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"
)

# 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]

# calls open_movies_page to generate die_hard_movies.htlm file
die_hard_movies.open_movies_page(movies)
10 changes: 10 additions & 0 deletions project1_die_hard/media.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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