forked from udacity/ud036_StarterCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Udacity Project udacity#1 - Movie Database:s
- Loading branch information
sherinkuruvilla
committed
Jan 21, 2018
1 parent
4af45a6
commit 28ae5de
Showing
5 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import fresh_tomatoes | ||
import media | ||
import time | ||
|
||
toy_story=media.Movie("Toy Story", | ||
"This is a story of a kid and his toys coming to life", | ||
"https://lumiere-a.akamaihd.net/v1/images/open-uri20150422-20810-m8zzyx_5670999f.jpeg?region=0,0,300,450", | ||
"https://www.youtube.com/watch?v=KYz2wyBy3kc&start=16&end=55") | ||
## "https://www.youtube-nocookie.com/embed/KYz2wyBy3kc?showinfo=0&start=16&end=55&autoplay=1&rel=0") | ||
##print(toy_story.story_line) | ||
##toy_story.show_poster() | ||
##time.sleep(3) | ||
##toy_story.show_trailer() | ||
|
||
avatar=media.Movie("Avatar", | ||
"Avatar is a distant planet with a native alien species colonized by humans", | ||
"http://theideasbodega.com.au/wp-content/uploads/2015/01/neytiri_in_avatar_2-wide-do-we-really-need-avatar-2-1024x640.jpeg", | ||
"https://www.youtube.com/watch?v=d1_JBMrrYw8&start=84&end=127") | ||
## "https://www.youtube-nocookie.com/embed/d1_JBMrrYw8?showinfo=0&start=84&end=127&autoplay=1&rel=0") | ||
##avatar.show_trailer() | ||
|
||
pulimurugan=media.Movie("Pulimurugan", | ||
"Malayalam thriller starring Mohan Lal as the catcher of Tiger, PuliMurugan", | ||
"http://pressks.com/wp-content/uploads/2016/10/puli-murugan-first-day-collection.jpg", | ||
"https://www.youtube.com/watch?v=blQUlD8g4Pk&start=54&end=94") | ||
## "https://www.youtube-nocookie.com/embed/blQUlD8g4Pk?showinfo=0&start=54&end=94&autoplay=1&rel=0") | ||
##pulimurugan.show_trailer() | ||
|
||
dhangal=media.Movie("Dhangal", | ||
"Award winning Amir Khan hindi action cinema about Indian Wrestler Sisters rise to fame", | ||
"http://t3.gstatic.com/images?q=tbn:ANd9GcQIXnFlBKGWT1ByyIu3qfxX6opQX6BmeeU_qsiE3X8rX9ZRr63r", | ||
"https://www.youtube.com/watch?v=x_7YlGv9u1g&start=0&end=141") | ||
## "https://www.youtube-nocookie.com/embed/x_7YlGv9u1g?showinfo=0&start=141&end=183&autoplay=1&rel=0") | ||
##dhangal.show_trailer() | ||
movies=[dhangal, avatar, pulimurugan, toy_story] | ||
fresh_tomatoes.open_movies_page(movies) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
|
||
<!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="#">Fresh Tomatoes 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="x_7YlGv9u1g" data-toggle="modal" data-target="#trailer"> | ||
<img src="http://t3.gstatic.com/images?q=tbn:ANd9GcQIXnFlBKGWT1ByyIu3qfxX6opQX6BmeeU_qsiE3X8rX9ZRr63r" width="220" height="342"> | ||
<h2>Dhangal</h2> | ||
</div> | ||
|
||
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="d1_JBMrrYw8" data-toggle="modal" data-target="#trailer"> | ||
<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"> | ||
<h2>Avatar</h2> | ||
</div> | ||
|
||
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="blQUlD8g4Pk" data-toggle="modal" data-target="#trailer"> | ||
<img src="http://pressks.com/wp-content/uploads/2016/10/puli-murugan-first-day-collection.jpg" width="220" height="342"> | ||
<h2>Pulimurugan</h2> | ||
</div> | ||
|
||
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id="KYz2wyBy3kc" data-toggle="modal" data-target="#trailer"> | ||
<img src="https://lumiere-a.akamaihd.net/v1/images/open-uri20150422-20810-m8zzyx_5670999f.jpeg?region=0,0,300,450" width="220" height="342"> | ||
<h2>Toy Story</h2> | ||
</div> | ||
|
||
</div> | ||
</body> | ||
</html> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import webbrowser | ||
|
||
class Movie: | ||
"""Author: Sherin Kuruvilla | ||
This class Movie is stored in a module or file named media | ||
The Movie class defines an object that can store details about movies""" | ||
|
||
#VALID_RATINGS=["G", "PG", "PG-13", "R"] | ||
|
||
def __init__(self, movie_title, movie_story_line, movie_poster_image, movie_youtube_trailer): | ||
self.title=movie_title | ||
self.story_line=movie_story_line | ||
self.poster_image_url=movie_poster_image | ||
self.trailer_youtube_url=movie_youtube_trailer | ||
|
||
def show_trailer(self): | ||
#print self.youtube_trailer | ||
webbrowser.open(self.youtube_trailer) | ||
|
||
def show_poster(self): | ||
webbrowser.open(self.poster_image) |