Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding script to generate movie pages #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
83 changes: 83 additions & 0 deletions batch-1/movie-info/sanish/Lucy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>Lucy</title>
<link rel="shortcut icon" href="http://ia.media-imdb.com/images/M/MV5BODcxMzY3ODY1NF5BMl5BanBnXkFtZTgwNzg1NDY4MTE@._V1_SX300.jpg" />
<style type="text/css">
header {
border-bottom: 1px solid #e00;
}

.poster {
float: left;
position: relative;
}

.poster img {
height: 200px;
margin-top: 30px;
border-radius: 10px;
}

.content {
display: inline;
}

.movie-information .info {
margin-left: 10px;
}

.movie-information .info h5, .movie-information .info p {
display: inline;
line-height: 30px;
}

body {
background-color: #eee;
}

.container {
margin: 30px 200px;
background-color: white;
border-radius: 5px;
padding: 20px 20px 20px 20px;
}

.movie-information {
margin: 30px 0px 100% 160px;
background-color: rgba(238, 238, 238, 0.35);
border-radius: 5px;
padding: 20px 20px 20px 20px;
}
</style>
</head>
<body>

<div class="container">
<header>
<h1>Lucy</h1>
</header>

<div class="content">
<div class="poster">
<img src="http://ia.media-imdb.com/images/M/MV5BODcxMzY3ODY1NF5BMl5BanBnXkFtZTgwNzg1NDY4MTE@._V1_SX300.jpg">
</div>

<div class="movie-information">
<p>A woman, accidentally caught in a dark deal, turns the tables on her captors and transforms into a merciless warrior evolved beyond human logic.</p>

<div class="info">
<h5>AUTHOR</h5>
<p>Luc Besson</p>
</div>

<div class="info">
<h5>YEAR</h5>
<p>2014</p>
</div>
</div>
</div>
</div>
</body>
</html>

30 changes: 30 additions & 0 deletions batch-1/movie-info/sanish/movie_ruby.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'open-uri'
require 'json'

class MovieDataGenerator

def initialize(movie_name)
@movie_tilte = "http://www.omdbapi.com/?t=#{movie_name}&y=&plot=short&r=json"
end

def read_movie
api_data=open(@movie_tilte).read
m_info=JSON.parse(api_data)
temp_html=File.read('template.html')
temp_html.gsub!('{{Poster}}',m_info['Poster'])
temp_html.gsub!('{{Title}}',m_info['Title'])
temp_html.gsub!('{{Plot}}',m_info['Plot'])
temp_html.gsub!('{{Director}}',m_info['Director'])
temp_html.gsub!('{{Year}}',m_info['Year'])

write_html(temp_html)
end

def write_html(template)
File.write("Lucy.html",template)
end

end

MovieDataGenerator.new('Lucy').read_movie

83 changes: 83 additions & 0 deletions batch-1/movie-info/sanish/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>{{Title}}</title>
<link rel="shortcut icon" href="{{Poster}}" />
<style type="text/css">
header {
border-bottom: 1px solid #e00;
}

.poster {
float: left;
position: relative;
}

.poster img {
height: 200px;
margin-top: 30px;
border-radius: 10px;
}

.content {
display: inline;
}

.movie-information .info {
margin-left: 10px;
}

.movie-information .info h5, .movie-information .info p {
display: inline;
line-height: 30px;
}

body {
background-color: #eee;
}

.container {
margin: 30px 200px;
background-color: white;
border-radius: 5px;
padding: 20px 20px 20px 20px;
}

.movie-information {
margin: 30px 0px 100% 160px;
background-color: rgba(238, 238, 238, 0.35);
border-radius: 5px;
padding: 20px 20px 20px 20px;
}
</style>
</head>
<body>

<div class="container">
<header>
<h1>{{Title}}</h1>
</header>

<div class="content">
<div class="poster">
<img src="{{Poster}}">
</div>

<div class="movie-information">
<p>{{Plot}}</p>

<div class="info">
<h5>AUTHOR</h5>
<p>{{Director}}</p>
</div>

<div class="info">
<h5>YEAR</h5>
<p>{{Year}}</p>
</div>
</div>
</div>
</div>
</body>
</html>