Commit c0f8cdee authored by Ganesh Katrapati's avatar Ganesh Katrapati
Browse files

Initial Push

parents
from bottle import Bottle, run, template, debug, static_file, request
import os, sys
import requests
dirname = os.path.dirname(sys.argv[0])
API_KEY="e4fc6e10"
app = Bottle()
def get_movie(movie_id):
url=f"http://www.omdbapi.com/?i={movie_id}&apikey={API_KEY}"
response = requests.get(url)
return response.json()
def get_movies(movie_name):
url=f"http://www.omdbapi.com/?s={movie_name}&apikey={API_KEY}"
response = requests.get(url)
response = response.json()
if response:
movies = response['Search']
movie_data = {}
for id, movie in enumerate(movies):
movie_id = movie['imdbID']
movie_data[id] = get_movie(movie_id)
movie_data[id]['Genre'] = movie_data[id]['Genre'].split(',')
if movie_data[id]['imdbRating'] != 'N/A':
movie_data[id]['imdbRating'] = str(float(movie_data[id]['imdbRating']) * 10) + '%'
else:
movie_data[id]['imdbRating'] = '0%'
return movie_data
@app.route('/', method='GET')
@app.route('/', method='POST')
def index():
search_results = {}
if request.method == "POST":
movie_name = request.forms.get('movie_name')
search_results = get_movies(movie_name)
# print(search_results)
return template('index.html', movies = search_results)
@app.route('/static/<filename:path>')
def send_static(filename):
static_f = static_file(filename, root='static/')
return static_f
run(app, host='0.0.0.0', port=8000)
The MIT License (MIT)
Copyright (c) 2014-2018 Materialize
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<p align="center">
<a href="http://materializecss.com/">
<img src="http://materializecss.com/res/materialize.svg" width="150">
</a>
<h3 align="center">MaterializeCSS</h3>
<p align="center">
Materialize, a CSS Framework based on material design.
<br>
<a href="http://materializecss.com/"><strong>-- Browse the docs --</strong></a>
<br>
<br>
<a href="https://travis-ci.org/Dogfalo/materialize">
<img src="https://travis-ci.org/Dogfalo/materialize.svg?branch=master" alt="Travis CI badge">
</a>
<a href="https://badge.fury.io/js/materialize-css">
<img src="https://badge.fury.io/js/materialize-css.svg" alt="npm version badge">
</a>
<a href="https://cdnjs.com/libraries/materialize">
<img src="https://img.shields.io/cdnjs/v/materialize.svg" alt="CDNJS version badge">
</a>
<a href="https://david-dm.org/Dogfalo/materialize">
<img src="https://david-dm.org/Dogfalo/materialize/status.svg" alt="dependencies Status badge">
</a>
<a href="https://david-dm.org/Dogfalo/materialize#info=devDependencies">
<img src="https://david-dm.org/Dogfalo/materialize/dev-status.svg" alt="devDependency Status badge">
</a>
<a href="https://gitter.im/Dogfalo/materialize">
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter badge">
</a>
</p>
## Table of Contents
- [Quickstart](#quickstart)
- [Documentation](#documentation)
- [Supported Browsers](#supported-browsers)
- [Changelog](#changelog)
- [Testing](#testing)
- [Contributing](#contributing)
- [Copyright and license](#copyright-and-license)
## Quickstart:
Read the [getting started guide](http://materializecss.com/getting-started.html) for more information on how to use materialize.
- [Download the latest release](https://github.com/Dogfalo/materialize/releases/latest) of materialize directly from GitHub.
- Clone the repo: `git clone https://github.com/Dogfalo/materialize.git`
- Include the files via [cdnjs](https://cdnjs.com/libraries/materialize). More [here](http://materializecss.com/getting-started.html).
- Install with [npm](https://www.npmjs.com): `npm install materialize-css`
- Install with [Bower](https://bower.io): `bower install materialize` ([DEPRECATED](https://bower.io/blog/2017/how-to-migrate-away-from-bower/))
- Install with [Atmosphere](https://atmospherejs.com): `meteor add materialize:materialize`
## Documentation
The documentation can be found at <http://materializecss.com>. To run the documentation locally on your machine, you need [Node.js](https://nodejs.org/en/) installed on your computer.
### Running documentation locally
Run these commands to set up the documentation:
```bash
git clone https://github.com/Dogfalo/materialize
cd materialize
npm install
```
Then run `grunt monitor` to compile the documentation. When it finishes, open a new browser window and navigate to `localhost:8000`. We use [BrowserSync](https://www.browsersync.io/) to display the documentation.
### Documentation for previous releases
Previous releases and their documentation are available for [download](https://github.com/Dogfalo/materialize/releases).
## Supported Browsers:
Materialize is compatible with:
- Chrome 35+
- Firefox 31+
- Safari 9+
- Opera
- Edge
- IE 11+
## Changelog
For changelogs, check out [the Releases section of materialize](https://github.com/Dogfalo/materialize/releases) or the [CHANGELOG.md](CHANGELOG.md).
## Testing
We use Jasmine as our testing framework and we're trying to write a robust test suite for our components. If you want to help, [here's a starting guide on how to write tests in Jasmine](CONTRIBUTING.md#jasmine-testing-guide).
## Contributing
Check out the [CONTRIBUTING document](CONTRIBUTING.md) in the root of the repository to learn how you can contribute. You can also browse the [help-wanted](https://github.com/Dogfalo/materialize/labels/help-wanted) tag in our issue tracker to find things to do.
## Copyright and license
Code copyright 2017 Materialize. Code released under the MIT license.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/materialize/css/materialize.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class='container'>
<div class=' card row cyan lighten-4' >
<form method='post' class="card-content col s12" action='/'>
<span class="card-title">Movie Search</span>
<div class="row">
<div class="input-field col s10">
<input placeholder="Search for a Movie" id="movie_name" name="movie_name" type="text" class="validate">
</div>
<div class="input-field col s2">
<input class="waves-effect waves-light btn-small" type="submit" class="validate">
</div>
</div>
</form>
</div>
% if movies:
% for movie_id, movie in movies.items():
% if movie_id % 3 == 0:
% if movie_id > 0:
</div>
% end
<div class='row'>
% end
<div class='col m4'>
<div class='card'>
<div class='card-image'>
<img src='{{movie['Poster']}}'>
</div>
<div class='card-content'>
<span class='card-title'>{{movie['Title']}}</span>
% for genre in movie['Genre']:
<div class='chip'>
{{genre}}
</div>
% end
<table>
<tr><td>Director</td><td>{{movie['Director']}}</td></tr>
<tr><td>Cast</td><td>{{movie['Actors']}}</td></tr>
<tr><td>Rating</td><td><div class='progress'><div class='determinate' style='width:{{movie['imdbRating']}}'></div></div></td></tr>
</table>
</div>
</div>
</div>
% end
% end
</div>
</body>
</html>
<html>
<head>
</head>
<body>
<h1>It works !</h1>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment