Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

IT Optics

MOVIE FINDER

Crystian Chavez | Cristian Rodriguez | Emmanuel Salcedo | Ranjita Summan


CST336-40 Final Project
We at IT Optics set out to create a website that allows you to personally create your own
movie rating list. This list would hold ratings and comments you had about movies you
have watched. The home page would also randomly show a movie to expose the user to
other movies they may not have watched. After discussing this project as a team, this is
how we broke down the tasks:

− Crystian Chavez – Team leader, worked on functions that pulled movies from the
database and created the rating webpage that lists the movies that have a rating
from the database. This fulfilled the requirements for user interaction with three
different form elements.

− Ranjita Summan – Worked on-site layout and design. Help create the node project
file structure and focus on CSS design.

− Christian Rodriguez – Worked on User input into the database as well as the
option to update user information from the data.

− Emmanuel Salcedo – Created the SQL data in their MySQL instance. Created an
API to pull 100 movies from IMBD to initially fill the database. Worked on a search
button that searched for movies and pulled the movie from API to add to the
database.

PROJECT
The initial goal of the project was to be able to have a session personalized for each user.
Due to time constraints, we decided it was best to change the layout so that there was a
drop-down box for the list of users to select from to link the rating to the right user.
Overall, we feel that this project met the initial vision of what we expected to accomplish.

OMDb API

To populate our database with real Movie data and allow the user to find movies we used
the OMDb API. The Open Movie Database. This database allowed us to find a movie and
all the corresponding data attached to that movie.

Our first API usage was a Python Script to populate the database with movie data. Using
the PANDAS library, we could iterate through a list of movies. Each movie made an API

PAGE 1
Call and then the data received was parsed and sent to the database through an INSERT
INTO SQL call.

We used the OMDb API in two ways:

Prior to usage, we were required to request an API Key, our key was provided and allowed
up to 1000 API calls per 24hr period.

http://www.omdbapi.com/?t-[MovieTitle]apikey=[yourkey]&

The “t-” tag allowed us to use the API with the Title of the movie, we used this API Call to
get other information we needed about the movie from the Poster image URL, and actors,
to ratings when we only had the Movie title.

http://www.omdbapi.com/?i-[IMDbID]apikey=[yourkey]&

The “i-” tag allowed us to use the API when all we had were the IMDb IDs for each movie.
In order to populate the database we found a CSV file of the top 100 movies, this file
provided us with the IMDb IDs. We then used the IMDb IDs to populate the Database for
usage in our program. The code to accomplish this is shown below.

import pandas as pd

import requests

import mysql.connector

mydb = mysql.connector.connect(

host= "au77784bkjx6ipju.cbetxkdyhwsb.us-east-1.rds.amazonaws.com",

user= "iu367i5x86axzzul",

password= "n559zko9h4b8ycwz",

database= "a4d2forehsyaisut"

df = pd.read_csv('movies.csv')

PAGE 2
column = df.loc[:, 'imdb_title_id']

for x in column:

url = ('http://www.omdbapi.com/?i='+x+'&apikey=f77e3bd8')

http://www.omdbapi.com/?t=Pokemon&apikey=f77e3bd8

r = requests.get(url)

json = r.json()

title = json['Title']

year = json['Year']

rated = json['Rated']

released = json['Released']

runtime = json['Runtime']

genre= json['Genre']

poster = json['Poster']

plot = json['Plot']

director = json['Director']

awards = json['Awards']

mycursor.execute('INSERT INTO a4d2forehsyaisut.movies(title, year, rated, released,


runtime, genre, poster, plot, director, awards) VALUES (%s, %s, %s,%s,%s,%s,%s,%s,%s,%s)',
(title, year, rated, released, runtime, genre, poster, plot, director, awards))

mydb.commit()

PAGE 3
Database Schema

Project screen shots

This is the home page for our website. The movie shown is randomly pulled from the
database. We feel this allows users to learn about movies that they may not know exists.

PAGE 4
The Rating page is where you can view the movies you’ve already rated. This is allows you
to review your history and remember by a specific movie wasn’t worth it.

PAGE 5

You might also like