Skip to content

Commit 28ae5de

Browse files
author
sherinkuruvilla
committed
Sherin Kuruvilla
Udacity Project udacity#1 - Movie Database:s
1 parent 4af45a6 commit 28ae5de

5 files changed

Lines changed: 187 additions & 0 deletions

File tree

entertaintment_center.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import fresh_tomatoes
2+
import media
3+
import time
4+
5+
toy_story=media.Movie("Toy Story",
6+
"This is a story of a kid and his toys coming to life",
7+
"https://lumiere-a.akamaihd.net/v1/images/open-uri20150422-20810-m8zzyx_5670999f.jpeg?region=0,0,300,450",
8+
"https://www.youtube.com/watch?v=KYz2wyBy3kc&start=16&end=55")
9+
## "https://www.youtube-nocookie.com/embed/KYz2wyBy3kc?showinfo=0&start=16&end=55&autoplay=1&rel=0")
10+
##print(toy_story.story_line)
11+
##toy_story.show_poster()
12+
##time.sleep(3)
13+
##toy_story.show_trailer()
14+
15+
avatar=media.Movie("Avatar",
16+
"Avatar is a distant planet with a native alien species colonized by humans",
17+
"http://theideasbodega.com.au/wp-content/uploads/2015/01/neytiri_in_avatar_2-wide-do-we-really-need-avatar-2-1024x640.jpeg",
18+
"https://www.youtube.com/watch?v=d1_JBMrrYw8&start=84&end=127")
19+
## "https://www.youtube-nocookie.com/embed/d1_JBMrrYw8?showinfo=0&start=84&end=127&autoplay=1&rel=0")
20+
##avatar.show_trailer()
21+
22+
pulimurugan=media.Movie("Pulimurugan",
23+
"Malayalam thriller starring Mohan Lal as the catcher of Tiger, PuliMurugan",
24+
"http://pressks.com/wp-content/uploads/2016/10/puli-murugan-first-day-collection.jpg",
25+
"https://www.youtube.com/watch?v=blQUlD8g4Pk&start=54&end=94")
26+
## "https://www.youtube-nocookie.com/embed/blQUlD8g4Pk?showinfo=0&start=54&end=94&autoplay=1&rel=0")
27+
##pulimurugan.show_trailer()
28+
29+
dhangal=media.Movie("Dhangal",
30+
"Award winning Amir Khan hindi action cinema about Indian Wrestler Sisters rise to fame",
31+
"http://t3.gstatic.com/images?q=tbn:ANd9GcQIXnFlBKGWT1ByyIu3qfxX6opQX6BmeeU_qsiE3X8rX9ZRr63r",
32+
"https://www.youtube.com/watch?v=x_7YlGv9u1g&start=0&end=141")
33+
## "https://www.youtube-nocookie.com/embed/x_7YlGv9u1g?showinfo=0&start=141&end=183&autoplay=1&rel=0")
34+
##dhangal.show_trailer()
35+
movies=[dhangal, avatar, pulimurugan, toy_story]
36+
fresh_tomatoes.open_movies_page(movies)
37+

fresh_tomatoes.html

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Fresh Tomatoes!</title>
7+
8+
<!-- Bootstrap 3 -->
9+
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
10+
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
11+
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
12+
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
13+
<style type="text/css" media="screen">
14+
body {
15+
padding-top: 80px;
16+
}
17+
#trailer .modal-dialog {
18+
margin-top: 200px;
19+
width: 640px;
20+
height: 480px;
21+
}
22+
.hanging-close {
23+
position: absolute;
24+
top: -12px;
25+
right: -12px;
26+
z-index: 9001;
27+
}
28+
#trailer-video {
29+
width: 100%;
30+
height: 100%;
31+
}
32+
.movie-tile {
33+
margin-bottom: 20px;
34+
padding-top: 20px;
35+
}
36+
.movie-tile:hover {
37+
background-color: #EEE;
38+
cursor: pointer;
39+
}
40+
.scale-media {
41+
padding-bottom: 56.25%;
42+
position: relative;
43+
}
44+
.scale-media iframe {
45+
border: none;
46+
height: 100%;
47+
position: absolute;
48+
width: 100%;
49+
left: 0;
50+
top: 0;
51+
background-color: white;
52+
}
53+
</style>
54+
<script type="text/javascript" charset="utf-8">
55+
// Pause the video when the modal is closed
56+
$(document).on('click', '.hanging-close, .modal-backdrop, .modal', function (event) {
57+
// Remove the src so the player itself gets removed, as this is the only
58+
// reliable way to ensure the video stops playing in IE
59+
$("#trailer-video-container").empty();
60+
});
61+
// Start playing the video whenever the trailer modal is opened
62+
$(document).on('click', '.movie-tile', function (event) {
63+
var trailerYouTubeId = $(this).attr('data-trailer-youtube-id')
64+
var sourceUrl = 'http://www.youtube.com/embed/' + trailerYouTubeId + '?autoplay=1&html5=1';
65+
$("#trailer-video-container").empty().append($("<iframe></iframe>", {
66+
'id': 'trailer-video',
67+
'type': 'text-html',
68+
'src': sourceUrl,
69+
'frameborder': 0
70+
}));
71+
});
72+
// Animate in the movies when the page loads
73+
$(document).ready(function () {
74+
$('.movie-tile').hide().first().show("fast", function showNext() {
75+
$(this).next("div").show("fast", showNext);
76+
});
77+
});
78+
</script>
79+
</head>
80+
81+
<body>
82+
<!-- Trailer Video Modal -->
83+
<div class="modal" id="trailer">
84+
<div class="modal-dialog">
85+
<div class="modal-content">
86+
<a href="#" class="hanging-close" data-dismiss="modal" aria-hidden="true">
87+
<img src="https://lh5.ggpht.com/v4-628SilF0HtHuHdu5EzxD7WRqOrrTIDi_MhEG6_qkNtUK5Wg7KPkofp_VJoF7RS2LhxwEFCO1ICHZlc-o_=s0#w=24&h=24"/>
88+
</a>
89+
<div class="scale-media" id="trailer-video-container">
90+
</div>
91+
</div>
92+
</div>
93+
</div>
94+
95+
<!-- Main Page Content -->
96+
<div class="container">
97+
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
98+
<div class="container">
99+
<div class="navbar-header">
100+
<a class="navbar-brand" href="#">Fresh Tomatoes Movie Trailers</a>
101+
</div>
102+
</div>
103+
</div>
104+
</div>
105+
<div class="container">
106+
107+
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="x_7YlGv9u1g" data-toggle="modal" data-target="#trailer">
108+
<img src="http://t3.gstatic.com/images?q=tbn:ANd9GcQIXnFlBKGWT1ByyIu3qfxX6opQX6BmeeU_qsiE3X8rX9ZRr63r" width="220" height="342">
109+
<h2>Dhangal</h2>
110+
</div>
111+
112+
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="d1_JBMrrYw8" data-toggle="modal" data-target="#trailer">
113+
<img src="http://theideasbodega.com.au/wp-content/uploads/2015/01/neytiri_in_avatar_2-wide-do-we-really-need-avatar-2-1024x640.jpeg" width="220" height="342">
114+
<h2>Avatar</h2>
115+
</div>
116+
117+
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="blQUlD8g4Pk" data-toggle="modal" data-target="#trailer">
118+
<img src="http://pressks.com/wp-content/uploads/2016/10/puli-murugan-first-day-collection.jpg" width="220" height="342">
119+
<h2>Pulimurugan</h2>
120+
</div>
121+
122+
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="KYz2wyBy3kc" data-toggle="modal" data-target="#trailer">
123+
<img src="https://lumiere-a.akamaihd.net/v1/images/open-uri20150422-20810-m8zzyx_5670999f.jpeg?region=0,0,300,450" width="220" height="342">
124+
<h2>Toy Story</h2>
125+
</div>
126+
127+
</div>
128+
</body>
129+
</html>

fresh_tomatoes.pyc

5.2 KB
Binary file not shown.

media.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import webbrowser
2+
3+
class Movie:
4+
"""Author: Sherin Kuruvilla
5+
This class Movie is stored in a module or file named media
6+
The Movie class defines an object that can store details about movies"""
7+
8+
#VALID_RATINGS=["G", "PG", "PG-13", "R"]
9+
10+
def __init__(self, movie_title, movie_story_line, movie_poster_image, movie_youtube_trailer):
11+
self.title=movie_title
12+
self.story_line=movie_story_line
13+
self.poster_image_url=movie_poster_image
14+
self.trailer_youtube_url=movie_youtube_trailer
15+
16+
def show_trailer(self):
17+
#print self.youtube_trailer
18+
webbrowser.open(self.youtube_trailer)
19+
20+
def show_poster(self):
21+
webbrowser.open(self.poster_image)

media.pyc

1.25 KB
Binary file not shown.

0 commit comments

Comments
 (0)