add the movie_list script

This commit is contained in:
2018-08-29 10:32:06 +03:00
parent e70d6063e5
commit 391ae02488
5 changed files with 465 additions and 0 deletions

2
movie_list/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
index.html
jquery.dataTables.min.js

105
movie_list/index.py Executable file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python
from imdb import IMDb
import os, re, threading, time, sys, subprocess
from time import gmtime, strftime
path = os.path.dirname(sys.argv[0])
ia = IMDb()
movie_list = []
status_list = []
threads = []
query = []
html = """<html>
<head>
<title>My Movie List</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="../jquery-3.1.0.min.js"></script>
<script src="jquery.dataTables.min.js"></script>
<script>
$(document).ready(function(){
$('#sortable').DataTable({
"pageLength": -1,
"bPaginate": false
});
});
</script>
</head>
<body>
<header>
<div class="scroll-indicator" />
</header>
<base target="_parent" />
<table id="sortable" class="sortable">
<thead>
<tr><th> Index </th><th> Title </th><th> Year </th><th> IMDb Rating </th><th> Genre </th><th> Status </th></tr>
</thead>
<tbody>"""
# Open the movie list & split the columns
file_ = open(path + '/movie_list', 'r')
tmp_names = tmp_status = file_.read()
file_.close()
tmp_names = re.sub(r'\).*', ')', tmp_names)
tmp_status = re.sub(r'\]|.*\[', '', tmp_status)
movie_list = tmp_names.splitlines()
status_list = tmp_status.splitlines()
# Scan IMDb for a given movie and append it to the html
# This collects rating, genres, official name and a hyperlink
def worker(arg, index):
save_stdout = sys.stdout
sys.stdout = open('trash', 'w')
query = ia.search_movie(arg)
sys.stdout = save_stdout
movie = query[0]
ia.update(movie)
movie['ID'] = query[0].movieID
if 'genres' not in movie.keys():
movie['genres'] = 'N/A'
if 'rating' not in movie.keys():
movie['rating'] = 'N/A'
global html
html = (html +
'\n\t<tr><td>' + str(index+1) + '</td><td><p hidden>' + movie['title'] + '</p>' +
'<a href="http://www.imdb.com/title/tt' + movie['ID'] + '" target="_blank">' +
str(movie['title']) +
'</a></td><td>' +
str(movie['year']) +
'</td><td align="center">' +
str(movie['rating']) +
'</td><td>' +
re.sub(r'\[|\]|\'', '', str(movie['genres'])) +
'</td><td align="center">' +
str(status_list[index]) +
'</td></tr>')
# Progress bar. Enough said
import progressbar
bar = progressbar.ProgressBar(max_value=len(movie_list))
for idx, val in enumerate(movie_list):
t = threading.Thread(target=worker, args=(val, idx,))
threads.append(t)
t.start()
bar.update(idx+1)
time.sleep(0.2)
if len(threads)%16 == 0:
time.sleep(6)
for x in threads:
x.join()
# Just a fancy scrollbar for the html
scroll = """
<script type="text/javascript" src="scroll-indicator.js"></script>
"""
html += ('\n\t</tbody>\n</table>\n' +
'\nGenerated on: ' + strftime('%Y-%m-%d %H:%M:%S', gmtime()) +
' by ' + sys.argv[0] + scroll + '</body>\n</html>')
file_ = open(path + '/index.html', 'wb')
file_.write(html.encode('utf8'))
file_.close()

306
movie_list/movie_list Normal file
View File

@@ -0,0 +1,306 @@
Edge of Tomorrow (2014) [DONE]
Third Person (2013) [DONE]
Outbreak (1995) [DONE]
Hanna (2011) [DONE]
School Ties (1992) [DONE]
I Am Legend (2007) [DONE]
Life Is Beautiful (1997) [DONE]
Hitch (2005) [DONE]
The Curious Case of Benjamin Button (2008) [DONE]
The Pursuit of Happyness (2006) [DONE]
Pay It Forward (2000) [DONE]
American Gangster (2007) [DONE]
Mr. Nobody (2009) [DONE]
The Jacket (2005) [DONE]
Two Night Stand (2014) [DONE]
Chef (2014) [DONE]
Mary and Max (2009) [DONE]
Lucky Number Slevin (2006) [DONE]
The Road (2009) [DONE]
Magnolia (1999) [DONE]
Il Mostro (1994) [DONE]
The Tiger and the Snow (2005) [DONE]
Lucy (2014) [DONE]
End of Watch (2012) [DONE]
The Prestige (2006) [DONE]
Léon (1994) [DONE]
Reservoir Dogs (1992) [DONE]
Ratatouille (2007) [DONE]
Cloud Atlas (2012) [DONE]
Office Space (1999) [DONE]
Life of Pi (2012) [DONE]
The Intouchables (2011) [DONE]
The Pianist (2002) [DONE]
Stand by Me (1986) [DONE]
Coach Carter (2005) [DONE]
Law Abiding Citizen (2009) [DONE]
The Butterfly Effect (2004) [DONE]
Devil's Advocate (1997) [DONE]
Braveheart (1995) [DONE]
Body of Lies (2008) [DONE]
Midnight in Paris (2011) [DONE]
Ghost Town (2008) [DONE]
RED (2010) [DONE]
The Fountain (2006) [DONE]
The Boy in the Striped Pajamas (2008) [DONE]
Ip Man (2008) [DONE]
The Bourne Identity (2002) [DONE]
The Bourne Supremacy (2004) [DONE]
The Bourne Ultimatum (2007) [DONE]
Heat (1995) [DONE]
A Beautiful Mind (2001) [DONE]
Sin City (2005) [DONE]
Fargo (1996) [DONE]
Snatch (2000) [DONE]
Blood Diamond (2006) [DONE]
The Departed (2006) [DONE]
Forrest Gump (1994) [DONE]
Schindler's List (1993) [DONE]
The Shawshank Redemption (1994) [DONE]
Limitless (2011) [DONE]
Seven Pounds (2008) [DONE]
I, Robot (2004) [DONE]
The Usual Suspects (1995) [DONE]
The Sixth Sense (1999) [DONE]
The Mechanic (2011) [DONE]
The King's Speech (2010) [DONE]
The Green Mile (1999) [DONE]
The Game (1997) [DONE]
The Edge (1997) [DONE]
Taken (2008) [DONE]
Taken 2 (2012) [DONE]
Taken 3 (2014) [DONE]
Shutter Island (2010) [DONE]
Scent of a Woman (1992) [DONE]
Papillon (1973) [DONE]
Oliver Twist (2005) [DONE]
Memento (2000) [DONE]
Lock, Stock and Two Smoking Barrels (1998) [DONE]
The Crimson Rivers (2000) [DONE]
Inception (2010) [DONE]
Headhunters (2011) [DONE]
Fearless (2006) [DONE]
Unleashed (2005) [DONE]
Catch Me If You Can (2002) [DONE]
Sweeney Todd: The Demon Barber of Fleet Street (2007) [DONE]
King of California (2007) [DONE]
Pulp Fiction (1994) [DONE]
The Godfather (1972) [DONE]
The Matrix (1999) [DONE]
The Matrix Reloaded (2003) [DONE]
The Matrix Revolutions (2003) [DONE]
Se7en (1995) [DONE]
The Rock (1996) [DONE]
Saving Private Ryan (1998) [DONE]
A Time to Kill (1996) [DONE]
The Hobbit: An Unexpected Journey (2012) [DONE]
The Hobbit: The Desolation of Smaug (2013) [DONE]
The Hobbit: The Battle of the Five Armies (2014) [DONE]
The Lord of the Rings: The Fellowship of the Ring (2001) [DONE]
The Lord of the Rings: The Two Towers (2002) [DONE]
The Lord of the Rings: The Return of the King (2003) [DONE]
The Machinist (2004) [DONE]
The Imaginarium of Doctor Parnassus (2009) [DONE]
Transcendence (2014) [DONE]
Dark Shadows (2012) [DONE]
The Rum Diary (2011) [DONE]
Pirates of the Caribbean: The Curse of the Black Pearl (2003) [DONE]
Pirates of the Caribbean: Dead Man's Chest (2006) [DONE]
Pirates of the Caribbean: At World's End (2007) [DONE]
Pirates of the Caribbean: On Stranger Tides (2011) [DONE]
Star Wars: Episode I - The Phantom Menace (1999) [DONE]
Star Wars: Episode II - Attack of the Clones (2002) [DONE]
Star Wars: Episode III - Revenge of the Sith (2005) [DONE]
Star Wars: Episode IV - A New Hope (1977) [DONE]
Star Wars: Episode V - The Empire Strikes Back (1980) [DONE]
Star Wars: Episode VI - Return of the Jedi (1983) [DONE]
Star Wars: Episode: The Force Awakens (2015) [DONE]
Star Wars: Rogue One (2016) [DONE]
Men in Black (1997) [DONE]
Men in Black II (2002) [DONE]
Men in Black 3 (2012) [DONE]
Hancock (2008) [DONE]
Silver Linings Playbook (2012) [DONE]
Meet the Parents (2000) [DONE]
Meet the Fockers (2004) [DONE]
Showtime (2002) [DONE]
Analyze This (1999) [DONE]
Jackie Brown (1997) [DONE]
The Untouchables (1987) [DONE]
Rango (2011) [DONE]
Lord of War (2005) [DONE]
Alice in Wonderland (2010) [DONE]
Public Enemies (2009) [DONE]
Corpse Bride (2005) [DONE]
Finding Neverland (2004) [DONE]
Secret Window (2004) [DONE]
Once Upon a Time in Mexico (2003) [DONE]
Blow (2001) [DONE]
Chocolat (2000) [DONE]
Sleepy Hollow (1999) [DONE]
The Man Who Cried (2000) [DONE]
The Ninth Gate (1999) [DONE]
Donnie Brasco (1997) [DONE]
Platoon (1986) [DONE]
One Flew Over the Cuckoo's Nest (1975) [DONE]
Goodfellas (1990) [DONE]
City of God (2002) [DONE]
Once Upon a Time in the West (1968) [DONE]
Gladiator (2000) [DONE]
300 (2006) [DONE]
Django Unchained (2012) [DONE]
American Beauty (1999) [DONE]
Black Swan (2010) [DONE]
WALL·E (2008) [DONE]
Amélie (2001) [DONE]
Eternal Sunshine of the Spotless Mind (2004) [DONE]
Inglourious Basterds (2009) [DONE]
Unforgiven (1992) [DONE]
Scarface (1983) [DONE]
Die Hard (1988) [DONE]
Die Hard 2 (1990) [DONE]
Die Hard: With a Vengeance (1995) [DONE]
Live Free or Die Hard (2007) [DONE]
A Good Day to Die Hard (2013) [DONE]
Die Another Day (2002) [DONE]
A Long Way Down (2014) [DONE]
Remember Me (2010) [DONE]
Automata (2014) [DONE]
The World Is Not Enough (1999) [DONE]
The Thomas Crown Affair (1999) [DONE]
Tomorrow Never Dies (1997) [DONE]
GoldenEye (1995) [DONE]
Mrs. Doubtfire (1993) [DONE]
Dracula Untold (2014) [DONE]
Interstellar (2014) [DONE]
Fury (2014) [DONE]
The Maze Runner (2014) [DONE]
Ender's Game (2013) [DONE]
Stonehearst Asylum (2014) [DONE]
Predestination (2014) [DONE]
Jurassic World (2015) [DONE]
Pan (2015) [DONE]
The Cobbler (2014) [DONE]
The Conjuring (2013) [DONE]
Starred Up (2013) [DONE]
Kraftidioten (2014) [DONE]
The Imitation Game (2014) [DONE]
Begin Again (2013) [DONE]
A Walk Among the Tombstones (2014) [DONE]
Detachment (2011) [DONE]
Identity (2003) [DONE]
Turist (Force Majeure) (2014) [DONE]
Gone Girl (2014) [DONE]
The Equalizer (2014) [DONE]
Desert Flower (2009) [DONE]
I Origins (2014) [DONE]
Whiplash (2014) [DONE]
Redirected (2014) [DONE]
Nightcrawler (2014) [DONE]
The Judge (2014) [DONE]
I Am Sam (2001) [DONE]
The Bank Job (2008) [DONE]
Child 44 (2015) [DONE]
Big Hero 6 (2014) [DONE]
Rise of the Guardians (2012) [DONE]
De vrais mensonges (2010) [DONE]
Unbroken (2014) [DONE]
Kingsman: The Secret Service (2014) [DONE]
Kidnapping Mr. Heineken (2015) [DONE]
The Blind Side (2009) [DONE]
Leviafan (2014) [DONE]
The Rewrite (2014) [DONE]
Focus (2015) [DONE]
The Wedding Ringer (2015) [DONE]
The Forger (2014) [DONE]
Project Almanac (2014) [DONE]
Run All Night (2015) [DONE]
The Age of Adaline (2015) [DONE]
Tomorrowland (2015) [DONE]
Before We Go (2014) [DONE]
John Doe: Vigilante (2014) [DONE]
Blown Away (1994) [DONE]
The Man from U.N.C.L.E. (2016) [DONE]
Southpaw (2015) [DONE]
Concussion (2015) [DONE]
Spy (2015) [DONE]
Gravity (2013) [DONE]
The Revenant (2015) [DONE]
Ex Machina (2014) [DONE]
The Martian (2015) [DONE]
Shelter (2014) [DONE]
Criminal Activities (2015) [DONE]
The Walk (2015) [DONE]
The Finest Hours (2016) [DONE]
Gods of Egypt (2016) [DONE]
The Terminal (2004) [DONE]
In The Heart of the Sea (2015) [DONE]
Secret in Their Eyes (2015) [DONE]
Zootopia (2016) [DONE]
Ip Man 3 (2015) [DONE]
Miss Peregrine's Home for Peculiar Children (2016) [DONE]
Deadpool (2016) [DONE]
Assassin's Creed (2016) [DONE]
John Q (2002) [DONE]
Now You See Me (2013) [DONE]
Up (2009) [DONE]
The Shallows (2016) [DONE]
Boychoir (2014) [DONE]
Same Kind of Different as Me (2017) [*]
Allied (2016) [DONE]
Mad Max: Fury Road (2015) [DONE]
Blood Father (2016) [DONE]
Citizenfour (2014) [DONE]
Kon-Tiki (2012) [DONE]
Our Kind of Traitor (2016) [DONE]
Inferno (2016) [DONE]
En man som heter Ove (2015) [DONE]
Ghost In The Shell (2017) [DONE]
War Dogs (2016) [DONE]
Equals (2015) [DONE]
The Outsiders (1983) [DONE]
Fantastic Beasts and Where to Find Them (2016) [DONE]
Joy (2015) [DONE]
Coherence (2013) [DONE]
The Elephant Man (1980) [DONE]
The Jungle Book (2016) [DONE]
The Girl on the Train (2016) [DONE]
Passengers (2016) [DONE]
Arrival (2016) [DONE]
Rust and Bone (2012) [DONE]
Jack Reacher (2012) [DONE]
At The End of The Tunnel (2016) [DONE]
The Town (2010) [DONE]
The Giver (2014) [DONE]
John Wick (2014) [DONE]
John Wick: Chapter 2 (2017) [DONE]
Lost in Translation (2003) [DONE]
The Graduate (1967) [DONE]
Logan (2017) [DONE]
K-PAX (2001) [DONE]
The Best Offer (2013) [DONE]
Fences (2016) [DONE]
Inside I'm Dancing (2004) [DONE]
My Name Is Khan (2010) [DONE]
Life (2017) [DONE]
Gifted (2017) [DONE]
Spider-Man: Homecoming (2017) [DONE]
Rememory (2017) [DONE]
Wristcutters: A Love Story (2006) [DONE]
Bohemian Rhapsody (2018) [*]
Killer's Bodyguard (2017) [*]
Danny Collins (2015) [DONE]
Annabelle: Creation (2017) [DONE]
Secrets of State (2008) [*]
Sleepers (1996) [*]
The Disaster Artist (2017) [*]
Slumdog Millionaire (2008) [DONE]
Ready Player One (2018) [DONE]
Dorian Gray (2009) [DONE]
Serenity (2018) [*]
Death Wish (2018) [DONE]
Loving Pablo (2017) [DONE]
Get Out (2017) [DONE]
Orphan (2009) [DONE]
Upgrade (2018) [DONE]
Dangal (2016) [DONE]

View File

@@ -0,0 +1,11 @@
(function() {
var si = document.querySelector(".scroll-indicator");
var onscroll = function() {
var max = document.body.scrollHeight - window.innerHeight;
si.style.display = "block";
si.style.width = (window.pageYOffset / max * 100) + "%";
};
window.onscroll = onscroll;
onscroll();
})();

41
movie_list/style.css Normal file
View File

@@ -0,0 +1,41 @@
.scroll-indicator {
display: none;
position: fixed;
top: 0;
left: 0;
width: 50%;
height: 10px;
background: #C33;
}
th {
background-color: #4CAF50;
cursor:pointer;
text-align: center;
}
th, td {
padding: 1px;
border-bottom: 1px solid #ddd;
font-family: arial, sans-serif;
font-size: 12px;
}
body {
background-color: #3D3635;
font-family: arial, sans-serif;
color: white;
font-size: 12px;
}
td {
color: #ffffff;
background-color: #3D3635;
}
a:link, a:visited {
background-color: #3D3635;
color: white;
text-decoration: none;
display: inline-block;
}