辅导案例-COMP3311-Assignment 2

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 1/7
COMP3311 20T1 Assignment 2
SQL, Python, SQLite
Database Systems
Last updated: Thursday 2nd April 11:32pm (most recent updates are in [..])
Downloads: a2.tgz, a2.zip
Note that a2.tgz and a2.zip contain the same material.
Each archive contains the IMDB database dump a2.db, plus a sample Python code file called sample.
Aims
This assignment aims to give you practice in
use of SQL in SQLite
writing scripts in Python that interact with a database
The goal is to complete the functionality of some command-line tools via a combination of database code and Python code.
Summary
Submission: Login to Course Web Site > Assignments > Assignment 2 > Assignment 2 Specification > Make Submission > upload required files > [Submit]
Required Files (total 4 files): acting, title, toprank, similar
Deadline: Friday 17 April 2020 @ 17:00
Late Penalty: Late submissions will have marks deducted from the maximum achievable mark at the rate of 0.5% of the total mark per hour that they are
late (i.e., 12% per day).
This assignment contributes 30 marks toward your total mark for this course.
The mark for each question indicates (roughly) its level of difficulty.
The total marks for the questions sum to 15, and will be scaled to 30.
How to do this assignment:
read this specification carefully and completely
login to grieg or a CSE linux machine
create a directory for this assignment
unpack the supplied zip file into this directory
get familiar with the schema and data by exploring and querying the provided database using the command: sqlite3 a2.db
familiarise (read the code) yourself with the provided sample Python code file called sample
try out the sample code by running: ./sample YEAR where YEAR is a number representing a year, e.g., 1989
make sure sample is executable (by chmod u+x sample) and run it
complete the tasks using sample as a reference template
submit all these files (the Required Files) via WebCMS3 as described above
Details of the above steps are given below. You can also edit and run the Python files on hosts other than grieg.
Introduction
A successful movie (or TV show) not only entertains audience, but also enables film companies to gain tremendous profit. A lot of factors (such as good
directors, experienced actors) are important for creating good movies. Nevertheless, famous directors and actors usually bring an attractive box-office income,
but they do not necessarily guarantee a highly rated imdb score. This assignment is based on an IMDB dataset to build several small Python commands to
show interesting results.
The dataset itself contains around 5000 movies, spanning across 100 years in 66 countries. There are more than 2000 movie directors, and thousands of
actors/actresses. It also contains the IMDB rating score, numbers of votes and various facebook likes. To let you feel the kind of data that you are dealing
with, a (unordered) glimpse of the dataset is included below:
cs3311@grieg:~/sqlite/a2$ sqlite3 a2.db
SQLite version 3.8.7.1 2014-10-29 13:59:56
Enter ".help" for usage hints.
sqlite>
sqlite> select * from movie limit 10;
1|Avatar|2009|PG-13|178|English|USA|760505847|237000000|735
2|Pirates of the Caribbean: At World's End|2007|PG-13|169|English|USA|309404152|300000000|555
3|Spectre|2015|PG-13|148|English|UK|200074175|245000000|1776
4|The Dark Knight Rises|2012|PG-13|164|English|USA|448130642|250000000|1078
6|John Carter|2012|PG-13|132|English|USA|73058679|263700000|2217
7|Spider-Man 3|2007|PG-13|156|English|USA|336530303|258000000|625
8|Tangled|2010|PG|100|English|USA|200807262|260000000|922
9|Avengers: Age of Ultron|2015|PG-13|141|English|USA|458991599|250000000|1410
10|Harry Potter and the Half-Blood Prince|2009|PG|153|English|UK|301956980|250000000|1117
11|Batman v Superman: Dawn of Justice|2016|PG-13|183|English|USA|330249062|250000000|2180
sqlite>
sqlite> .headers on
sqlite>
sqlite> select * from movie limit 10;
id|title|year|content_rating|duration|lang|country|gross|budget|director_id
1|Avatar|2009|PG-13|178|English|USA|760505847|237000000|735
2|Pirates of the Caribbean: At World's End|2007|PG-13|169|English|USA|309404152|300000000|555
3|Spectre|2015|PG-13|148|English|UK|200074175|245000000|1776
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 2/7
4|The Dark Knight Rises|2012|PG-13|164|English|USA|448130642|250000000|1078
6|John Carter|2012|PG-13|132|English|USA|73058679|263700000|2217
7|Spider-Man 3|2007|PG-13|156|English|USA|336530303|258000000|625
8|Tangled|2010|PG|100|English|USA|200807262|260000000|922
9|Avengers: Age of Ultron|2015|PG-13|141|English|USA|458991599|250000000|1410
10|Harry Potter and the Half-Blood Prince|2009|PG|153|English|UK|301956980|250000000|1117
11|Batman v Superman: Dawn of Justice|2016|PG-13|183|English|USA|330249062|250000000|2180
sqlite>
sqlite> select * from rating limit 10;
movie_id|num_critic_for_reviews|num_user_for_reviews|num_voted_users|movie_facebook_likes|cast_total_facebook_likes|imdb_score
1|723|3054|886204|33000|4834|7.9
2|302|1238|471220|0|48350|7.1
3|602|994|275868|85000|11700|6.8
4|813|2701|1144337|164000|106759|8.5
6|462|738|212204|24000|1873|6.6
7|392|1902|383056|0|46055|6.2
8|324|387|294810|29000|2036|7.8
9|635|1117|462669|118000|92000|7.5
10|375|973|321795|10000|58753|7.5
11|673|3018|371639|197000|24450|6.9
sqlite>
sqlite> .mode column
sqlite>
sqlite> select * from director limit 10;
id name facebook_likes
---------- ---------- --------------
1 JK Youn 2
2 David S. W 42
3 James Fraw 21
4 Kar-Wai Wo 0
5 Brian Tren 53
6 Perry Lang 17
7 Jeff Burr 155
8 Al Sillima 0
9 Morten Tyl 77
10 Hue Rhodes 0
sqlite>
sqlite> select * from actor limit 10;
id name facebook_likes
---------- ----------------- --------------
1 Maureen McCormick 458
2 Andrew Fiscella 137000
3 Brittany Daniel 861
4 Michael Smiley 177
5 Najarra Townsend 538
6 Gustaf Skarsgrd 908
7 Laila Haley 1000
8 Isaac C. Singleto 312
9 Veronica Ferres 30000
10 Chris 'Wonder' Sc 0
sqlite>
sqlite> select * from acting limit 10;
movie_id actor_id
---------- ----------
407 2024
3699 1841
3016 11
2846 195
3421 738
3645 1186
2430 211
4823 1299
1737 786
2282 866
sqlite>
sqlite> select * from genre limit 10;
movie_id genre
---------- ----------
407 Adventure
407 Comedy
407 Family
3699 Drama
3699 Horror
3699 Mystery
3699 Sci-Fi
3699 Thriller
3016 Drama
2846 Comedy
sqlite>
sqlite> select * from keyword limit 10;
movie_id keyword
---------- ----------
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 3/7
407 dog
407 parole
407 parole off
407 prison
407 puppy
3699 alien
3699 bunker
3699 car crash
3699 kidnapping
3699 minimal ca
sqlite>
sqlite> .width 10 30
sqlite>
sqlite> select * from keyword limit 10;
movie_id keyword
---------- ------------------------------
407 dog
407 parole
407 parole officer
407 prison
407 puppy
3699 alien
3699 bunker
3699 car crash
3699 kidnapping
3699 minimal cast
sqlite>
You may also explore the schema and any table information using the sqlite system catalog table called sqlite_master (as shown in the Week 7 lecture), or the
sqlite PRAGMA functions (please see the sqlite documentation for details), as shown in the examples below:
cs3311@grieg:~/sqlite/a2$ sqlite3 a2.db
SQLite version 3.8.7.1 2014-10-29 13:59:56
Enter ".help" for usage hints.
sqlite> .tables
acting actor director genre keyword movie rating
sqlite> pragma table_info(movie);
0|id|integer|1||1
1|title|character varying(256)|1||0
2|year|integer|0||0
3|content_rating|character varying(9)|0||0
4|duration|integer|0||0
5|lang|character varying(10)|0||0
6|country|character varying(20)|0||0
7|gross|bigint|0||0
8|budget|bigint|0||0
9|director_id|integer|0||0
sqlite>
sqlite> select * from sqlite_master where name="movie";
table|movie|movie|6|CREATE TABLE movie (
id integer NOT NULL,
title character varying(256) NOT NULL,
year integer,
content_rating character varying(9),
duration integer,
lang character varying(10),
country character varying(20),
gross bigint,
budget bigint,
director_id integer,
PRIMARY KEY (id),
FOREIGN KEY (director_id) REFERENCES director(id)
)
sqlite>
The sample Python program
By following the steps above, you can experience the provided sample program and study its code as follows:
cs3311@grieg:~/sqlite/a2$ ./sample
Usage: ./sample YEAR
cs3311@grieg:~/sqlite/a2$ ./sample 1989
A Nightmare on Elm Street 5: The Dream Child (1989)
Back to the Future Part II (1989)
Batman (1989)
Bill & Ted's Excellent Adventure (1989)
Black Rain (1989)
Born on the Fourth of July (1989)
Dead Poets Society (1989)
Do the Right Thing (1989)
Driving Miss Daisy (1989)
Friday the 13th Part VIII: Jason Takes Manhattan (1989)
Glory (1989)
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 4/7
Halloween 5 (1989)
Henry V (1989)
Indiana Jones and the Last Crusade (1989)
Licence to Kill (1989)
Major League (1989)
New York Stories (1989)
Pet Sematary (1989)
Road House (1989)
Roger & Me (1989)
Sea of Love (1989)
Sex, Lies, and Videotape (1989)
Star Trek V: The Final Frontier (1989)
Tango & Cash (1989)
The Abyss (1989)
The Blood of Heroes (1989)
The Toxic Avenger Part II (1989)
Troop Beverly Hills (1989)
UHF (1989)
Warlock (1989)
We're No Angels (1989)
When Harry Met Sally... (1989)
cs3311@grieg:~/sqlite/a2$ ls
a2.db sample
cs3311@grieg:~/sqlite/a2$
cs3311@grieg:~/sqlite/a2$ cat sample
#!/usr/bin/python3

"""
This is a sample program for COMP3311 20T1 Assignment 2 to illustrate how to write an
executable python code, take in commandline an argument, and connect to a sqlite3 db.
For simplicity (make it short and easier to read), it does not include much error checking,
exception handling and comments.
"""


import sqlite3,sys

if len(sys.argv) != 2 :
print("Usage:",sys.argv[0],"YEAR")
sys.exit(1)

year = sys.argv[1]

con = sqlite3.connect('a2.db')

cur = con.cursor()

cur.execute('SELECT title, year FROM movie WHERE year ={} ORDER BY title'.format(year))

while True:
t = cur.fetchone()
if t == None:
break
x,y = t
print('{} ({})'.format(x,y))

con.close()
cs3311@grieg:~/sqlite/a2$
Submission and Testing
We will test your submission on Grieg or other CSE linux hosts as follows:
create a testing subdirectory
place a modified a2.db file (with the same schema but probably slightly modified data) into that directory
place your submitted files in that directory and make them executable
run a series of tests using your submitted acting, title, toprank and similar scripts
manually inspect your submitted Python code (if time allows)
Your submitted code must be complete so that when we do the above, your Python will work just as it did in your assignment directory and with a database
with the identical schema (with either the same or slightly modified dataset) to yours (a2.db). For submission simplicity, please only submit the 4 required
Python files. In other words, do not break a Python program into multiple Python files (so each submitted file is a self-contained Python program). If your code
does not work when installed for testing on Grieg, as described above (for example, it works on your home machine perfectly, but we need to edit one line in
order to have it running properly on a CSE machine; OR it does not pass the auto tests due to extra debugging messages, etc), you will be penalised by at
least a 50% administrative penalty.
Before you submit, you should test out whether the files you submit will work by following a similar sequence of steps to those noted above on a CSE linux
machine such as Grieg.
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 5/7
Tasks
For each task, you are required to implement an executable Python program command that takes in commandline arguments and displays the result in a
specified format (which we will use for auto-marking). We assume the sample output format for each task below to to test your programs. If any field of your
output is empty, you should hide that field and its related formatting text (for example, in ./title examples below, a comma and a space will not be printed
for year if it is empty). Of course, you are free to print debugging information temporarily, but please remember to eventually disable or remove them when
your solution is submitted for marking. For all the tasks below, unless it is specified explicitly, we assume movies including any titles stored in the movie table
(i.e., including movies and TV shows etc).
For each task below, output nothing if there is no result returned from the database. If the task does not specify particular output order, your program can
output in any row order. If multiple columns are involved in your output, your output should follow the same column order as the sample output presented in
each task below.
Task A: The list of movies acted by a given actor (2 marks)
The acting script lists the movie title, its director, its year, its content rating and IMDB score, one per line, of all the movies acted by the given actor. The
output is sorted by year and then by movie title, both in ascending order. If any movies have empty year, output them at the end and sort them by movie title in
ascending order. It accepts one command-line argument: an actor name (has to exactly match a name stored in the database and the matching is case
insensitive). If there is no director, just leave it empty (i.e., it will be just a space between -- and the open bracket). It has the following output format:
grieg$ ./acting "james franco"
1. Whatever It Takes -- David Raynr (2000, PG-13, 5.5)
2. City by the Sea -- Michael Caton-Jones (2002, R, 6.2)
3. Deuces Wild -- Scott Kalvert (2002, R, 5.6)
4. Spider-Man -- Sam Raimi (2002, PG-13, 7.3)
5. Spider-Man 2 -- Sam Raimi (2004, PG-13, 7.3)
6. The Great Raid -- John Dahl (2005, R, 6.7)
7. Flyboys -- Tony Bill (2006, PG-13, 6.6)
8. The Dead Girl -- Karen Moncrieff (2006, R, 6.7)
9. In the Valley of Elah -- Paul Haggis (2007, R, 7.2)
10. Spider-Man 3 -- Sam Raimi (2007, PG-13, 6.2)
11. Milk -- Gus Van Sant (2008, R, 7.6)
12. Pineapple Express -- David Gordon Green (2008, R, 7.0)
13. 127 Hours -- Danny Boyle (2010, R, 7.6)
14. Date Night -- Shawn Levy (2010, PG-13, 6.3)
15. Eat Pray Love -- Ryan Murphy (2010, PG-13, 5.7)
16. Rise of the Planet of the Apes -- Rupert Wyatt (2011, PG-13, 7.6)
17. Your Highness -- David Gordon Green (2011, R, 5.6)
18. Spring Breakers -- Harmony Korine (2012, R, 5.3)
19. The Iceman -- Ariel Vromen (2012, R, 6.9)
20. Homefront -- Gary Fleder (2013, R, 6.5)
21. Oz the Great and Powerful -- Sam Raimi (2013, PG, 6.4)
22. Palo Alto -- Gia Coppola (2013, R, 6.3)
23. This Is the End -- Evan Goldberg (2013, R, 6.7)
24. The Interview -- Evan Goldberg (2014, R, 6.6)
25. The Little Prince -- Mark Osborne (2015, PG, 7.8)
26. Sausage Party -- Greg Tiernan (2016, R, 7.5)
For all the tasks in this assignment, as mentioned previously, your program shall output nothing if there are no results. If there are N results, it shall output
exactly N lines of output without any extra lines or messages. We can then use the line count to measure the size of an output. For example:
grieg$ ./acting "james franco"|wc -l
26
grieg$ ./acting "john smith" |wc -l
0

Task B: List movie information by its title substring (3 marks)
The title script lists the movie title, year, content rating, IMDB score and genres of those movies with the title matching the given substring (case
insensitive), one per line. The output of multiple genres of a movie should be concatenated in one line delimited by a comma and sorted alphabetically in
ascending order, as shown by an example below. The rows are ordered by year (ascending), then by IMDB rating (descending) and finally by title (ascending).
It has the following output format:
grieg$ ./title "star war"
1. Star Wars: Episode IV - A New Hope (1977, PG, 8.7) [Action,Adventure,Fantasy,Sci-Fi]
2. Star Wars: Episode V - The Empire Strikes Back (1980, PG, 8.8) [Action,Adventure,Fantasy,Sci-Fi]
3. Star Wars: Episode VI - Return of the Jedi (1983, PG, 8.4) [Action,Adventure,Fantasy,Sci-Fi]
4. Star Wars: Episode I - The Phantom Menace (1999, PG, 6.5) [Action,Adventure,Fantasy,Sci-Fi]
5. Star Wars: Episode II - Attack of the Clones (2002, PG, 6.7) [Action,Adventure,Fantasy,Sci-Fi]
6. Star Wars: Episode III - Revenge of the Sith (2005, PG-13, 7.6) [Action,Adventure,Fantasy,Sci-Fi]
7. Star Wars: The Clone Wars (TV-PG, 7.9) [Action,Adventure,Animation,Drama,Fantasy,Sci-Fi]

grieg$ ./title "happy"
1. Happy Gilmore (1996, PG-13, 7.0) [Comedy,Sport]
2. Happy, Texas (1999, PG-13, 6.3) [Comedy,Crime,Romance]
3. The Pursuit of Happyness (2006, PG-13, 8.0) [Biography,Drama]
4. Happy Feet (2006, PG, 6.5) [Animation,Comedy,Family,Music,Romance]
5. Another Happy Day (2011, R, 6.0) [Comedy,Drama]
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 6/7
6. Happy Feet 2 (2011, PG, 5.9) [Animation,Comedy,Family,Musical]
7. Happy Christmas (2014, R, 5.6) [Comedy,Drama]
8. Happy Valley (TV-MA, 8.5) [Crime,Drama]

grieg$ ./title "mars"
1. Invaders from Mars (1986, PG, 5.5) [Horror,Sci-Fi]
2. Mars Attacks! (1996, PG-13, 6.3) [Action,Comedy,Sci-Fi]
3. Mission to Mars (2000, PG, 5.6) [Adventure,Sci-Fi,Thriller]
4. Ghosts of Mars (2001, R, 4.9) [Action,Horror,Sci-Fi]
5. We Are Marshall (2006, PG, 7.1) [Drama,Sport]
6. Forgetting Sarah Marshall (2008, R, 7.2) [Comedy,Drama,Romance]
7. The 41-Year-Old Virgin Who Knocked Up Sarah Marshall and Felt Superbad About It (2010, R, 2.7) [Comedy]
8. Mars Needs Moms (2011, PG, 5.4) [Action,Adventure,Animation,Comedy,Family,Sci-Fi]
9. The Last Days on Mars (2013, R, 5.5) [Horror,Sci-Fi,Thriller]
10. Veronica Mars (TV-14, 8.4) [Crime,Drama,Mystery]
Task C: Top ranked movies (4 marks)
The toprank script takes in 3 or 4 commandline arguments:
./toprank K StartYear EndYear
or:
./toprank Genres K StartYear EndYear
where Genres is a list of genres separated by '&', K is the top K movies ranked by IMDB score and then by the number of votes (both in descending order)
between (and including) StartYear and EndYear, with 1 <= K <= 1000, 1900 < StartYear <= EndYear < 2020 and your program will not be tested with a list of
more than 8 genres. We interpret '&' as conjunction, i.e., the selected movies shall contain all the specified genres. When Genres is not provided (when your
program takes in 3 arguments), perform the same ranking but on movies with any genres. Do not include any movie titles with empty year. For example:
./toprank "Action&Sci-Fi&Adventure" 10 2005 2005
1. Serenity (2005, PG-13, English) [8.0, 242599]
2. Star Wars: Episode III - Revenge of the Sith (2005, PG-13, English) [7.6, 520104]
3. The Island (2005, PG-13, English) [6.9, 263329]
4. Zathura: A Space Adventure (2005, PG, English) [6.1, 67707]
5. Doom (2005, R, English) [5.2, 88146]
6. Stealth (2005, PG-13, English) [5.0, 45455]
7. A Sound of Thunder (2005, PG-13, English) [4.2, 16474]
8. The Helix... Loaded (2005, R, English) [1.9, 534]

./toprank "Sci-Fi&Adventure&Action" 20 1920 2019
1. Inception (2010, PG-13, English) [8.8, 1468200]
2. Star Wars: Episode V - The Empire Strikes Back (1980, PG, English) [8.8, 837759]
3. Star Wars: Episode IV - A New Hope (1977, PG, English) [8.7, 911097]
4. Star Wars: Episode VI - Return of the Jedi (1983, PG, English) [8.4, 681857]
5. Aliens (1986, R, English) [8.4, 488537]
6. Captain America: Civil War (2016, PG-13, English) [8.2, 272670]
7. Godzilla Resurgence (2016, Japanese) [8.2, 374]
8. The Avengers (2012, PG-13, English) [8.1, 995415]
9. Guardians of the Galaxy (2014, PG-13, English) [8.1, 682155]
10. Mad Max: Fury Road (2015, R, English) [8.1, 552503]
11. Deadpool (2016, R, English) [8.1, 479047]
12. Destiny (2014, English) [8.1, 3089]
13. X-Men: Days of Future Past (2014, PG-13, English) [8.0, 514125]
14. Star Trek (2009, PG-13, English) [8.0, 504419]
15. Serenity (2005, PG-13, English) [8.0, 242599]
16. The Iron Giant (1999, PG, English) [8.0, 128455]
17. Avatar (2009, PG-13, English) [7.9, 886204]
18. Iron Man (2008, PG-13, English) [7.9, 696338]
19. Edge of Tomorrow (2014, PG-13, English) [7.9, 431620]
20. Big Hero 6 (2014, PG, English) [7.9, 279093]

./toprank 20 1920 2019
1. The Shawshank Redemption (1994, R, English) [9.3, 1689764]
2. The Godfather (1972, R, English) [9.2, 1155770]
3. The Dark Knight (2008, PG-13, English) [9.0, 1676169]
4. The Godfather: Part II (1974, R, English) [9.0, 790926]
5. Pulp Fiction (1994, R, English) [8.9, 1324680]
6. The Lord of the Rings: The Return of the King (2003, PG-13, English) [8.9, 1215718]
7. Schindler's List (1993, R, English) [8.9, 865020]
8. The Good, the Bad and the Ugly (1966, Approved, Italian) [8.9, 503509]
9. 12 Angry Men (1957, Not Rated, English) [8.9, 447785]
10. Inception (2010, PG-13, English) [8.8, 1468200]
11. Fight Club (1999, R, English) [8.8, 1347461]
12. Forrest Gump (1994, PG-13, English) [8.8, 1251222]
13. The Lord of the Rings: The Fellowship of the Ring (2001, PG-13, English) [8.8, 1238746]
14. Star Wars: Episode V - The Empire Strikes Back (1980, PG, English) [8.8, 837759]
15. The Matrix (1999, R, English) [8.7, 1217752]
16. The Lord of the Rings: The Two Towers (2002, PG-13, English) [8.7, 1100446]
17. Star Wars: Episode IV - A New Hope (1977, PG, English) [8.7, 911097]
18. Goodfellas (1990, R, English) [8.7, 728685]
4/6/2020 COMP3311 20T1 - Assignment 2
https://cgi.cse.unsw.edu.au/~cs3311/20T1/assignments/a2/index.php 7/7
19. One Flew Over the Cuckoo's Nest (1975, R, English) [8.7, 680041]
20. City of God (2002, R, Portuguese) [8.7, 533200]
Task D: Similar movies (6 marks)
Suppose you are asked to implement a movie recommendation feature for IMDB. Based on the movie that a user is currently browsing, a list of similar movies
will be presented. In Task D, the similar script takes in 2 arguments: a case-insensitive movie full title (this shall produce a single match. If not, just use the
one with the most recent year as if it is the only match); and a number N (1 <= N <= 1000). It will then find its similar N movies (excluding itself) that share the
maximum number of common genres (output nothing if no other movies have any common genres with the given movie). For those with the same number of
common genres, they will then be ranked by the maximum number (including zero number) of common plot keywords. If both are the same, then they will be
ranked by their IMDB scores and then by the number of votes (the higher the better).
./similar "Happy Feet" 30
1. Hairspray (2007) [4, 2, 6.7, 98693]
2. Confessions of a Teenage Drama Queen (2004) [4, 1, 4.6, 23408]
3. Aladdin (1992) [4, 0, 8.0, 260939]
4. Tangled (2010) [4, 0, 7.8, 294810]
5. The Book of Life (2014) [4, 0, 7.3, 45580]
6. Shrek 2 (2004) [4, 0, 7.2, 314630]
7. Enchanted (2007) [4, 0, 7.1, 142496]
8. The Road to El Dorado (2000) [4, 0, 6.9, 58300]
9. A Monster in Paris (2011) [4, 0, 6.8, 15790]
10. Sinbad: Legend of the Seven Seas (2003) [4, 0, 6.7, 36144]
11. Bandslam (2009) [4, 0, 6.4, 11958]
12. Freaky Friday (2003) [4, 0, 6.1, 96693]
13. Rugrats in Paris: The Movie (2000) [4, 0, 6.1, 8146]
14. Home on the Range (2004) [4, 0, 5.4, 13581]
15. The Lizzie McGuire Movie (2003) [4, 0, 5.3, 27580]
16. Alpha and Omega (2010) [4, 0, 5.3, 10986]
17. Roadside Romeo (2008) [4, 0, 5.3, 922]
18. High School Musical (2006) [4, 0, 5.2, 59254]
19. Alvin and the Chipmunks (2007) [4, 0, 5.2, 57276]
20. Alvin and the Chipmunks: The Road Chip (2015) [4, 0, 5.0, 9418]
21. High School Musical 2 (2007) [4, 0, 4.8, 39786]
22. High School Musical 3: Senior Year (2008) [4, 0, 4.5, 43795]
23. Alvin and the Chipmunks: The Squeakquel (2009) [4, 0, 4.5, 31649]
24. Alvin and the Chipmunks: Chipwrecked (2011) [4, 0, 4.4, 22838]
25. Hannah Montana: The Movie (2009) [4, 0, 4.2, 31760]
26. Doug's 1st Movie (1999) [3, 2, 5.0, 2448]
27. Monsters, Inc. (2001) [3, 1, 8.1, 585659]
28. The Iron Giant (1999) [3, 1, 8.0, 128455]
29. Toy Story 2 (1999) [3, 1, 7.9, 385871]
30. Arthur [3, 1, 7.4, 8495]

./similar "The Shawshank Redemption" 30
1. American History X (1998) [2, 1, 8.6, 782437]
2. The Grand Budapest Hotel (2014) [2, 1, 8.1, 475518]
3. The Town (2010) [2, 1, 7.6, 280228]
4. Escape from Alcatraz (1979) [2, 1, 7.6, 87090]
5. Bronson (2008) [2, 1, 7.1, 84817]
6. Bandits (2001) [2, 1, 6.6, 57038]
7. Contraband (2012) [2, 1, 6.5, 101977]
8. Faster (2010) [2, 1, 6.5, 80574]
9. Hurricane Streets (1997) [2, 1, 6.5, 1038]
10. Undisputed (2002) [2, 1, 6.1, 21542]
11. Prison (1987) [2, 1, 5.9, 2705]
12. Fled (1996) [2, 1, 5.3, 7073]
13. Civil Brand (2002) [2, 1, 5.3, 553]
14. American Heist (2014) [2, 1, 5.2, 12372]
15. Get Rich or Die Tryin' (2005) [2, 1, 5.0, 35834]
16. The Godfather (1972) [2, 0, 9.2, 1155770]
17. The Dark Knight (2008) [2, 0, 9.0, 1676169]
18. The Godfather: Part II (1974) [2, 0, 9.0, 790926]
19. Fargo [2, 0, 9.0, 170055]
20. Pulp Fiction (1994) [2, 0, 8.9, 1324680]
21. 12 Angry Men (1957) [2, 0, 8.9, 447785]
22. Daredevil [2, 0, 8.8, 213483]
23. Goodfellas (1990) [2, 0, 8.7, 728685]
24. City of God (2002) [2, 0, 8.7, 533200]
25. Gomorrah [2, 0, 8.7, 9638]
26. Se7en (1995) [2, 0, 8.6, 1023511]
27. The Silence of the Lambs (1991) [2, 0, 8.6, 887467]
28. The Usual Suspects (1995) [2, 0, 8.6, 740918]
29. Hannibal [2, 0, 8.6, 159910]
30. Luther [2, 0, 8.6, 70568]
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468