finish processing all films

This commit is contained in:
Ben Goldsworthy 2024-01-08 23:58:41 +01:00
parent 716b5e555b
commit 97c32fb09a
6 changed files with 40674 additions and 18840 deletions

View file

@ -408,7 +408,7 @@
{
"title": "Storm from the Mountains: The Zapatistas Take Mexico City",
"original_language": "es",
"release_date": "2001",
"release_date": "2001-01-01",
"date_added": "2023-06-25",
"date_watched": "2023-06-19",
"comments": "CELMRAZ",
@ -436,7 +436,7 @@
"title": "Oventic: Constructing Dignity",
"original_language": "es",
"original_title": "Oventic: construyendo dignidad",
"release_date": "1996",
"release_date": "1996-01-01",
"date_added": "2023-06-07",
"date_watched": "2023-06-05",
"is_rewatch": false,
@ -5633,7 +5633,7 @@
"id": 903050,
"overview": "Throughout the South of the United States, tempers flare up as confederate monuments are targeted for removal. During a 6000 mile road trip through the former Confederacy, this documentary explores the legacy of Southern Heritage. A myriad of supporters and opponents is met along the way: White, Black, North and South. Each with their own view on what's worth remembering and preserving. Is there a way past these crossroads?",
"poster_path": "https://www.themoviedb.org/t/p/original//dYycXS0TMAALrnVRP0e03qBXRfQ.jpg",
"release_date": "2018",
"release_date": "2018-01-01",
"title": "Monumental Crossroads",
"date_added": "2021-11-24",
"date_watched": "2021-11-23",
@ -7216,7 +7216,7 @@
{
"title": "Blue",
"original_title": "\u015e\u00een",
"release_date": "2020",
"release_date": "2020-01-01",
"original_language": "ku",
"date_added": "2021-04-21",
"date_watched": "2021-04-20",
@ -9983,7 +9983,7 @@
"id": 892275,
"overview": "Armed Forces Day, Uniform to Work Day, Camo Day, National Heroes Day - in the streets, on television, on the web, at sports events, in schools, advertising and fashion \u2013 the military presence in civilian life is on the march. The public and ever younger children are being groomed to collude in the increasing militarisation of UK society. Interweaving the powerful and moving testimonies of veterans of Britain\u2019s unbroken century of wars with expert commentary, archive and a redolent score, War School\u2019s mosaic of sound and imagery evokes the story of the child soldier who becomes a peace campaigner, challenging the myth of Britain's benign role in world affairs and asking if perpetual war is really what we want for future generations?",
"poster_path": "https://www.themoviedb.org/t/p/original//8gnghAWmknGVXMvGzbigSqq7cyu.jpg",
"release_date": "2020",
"release_date": "2020-01-01",
"title": "War School: The Battle for Britain\u2019s Children",
"date_added": "2021-11-01",
"date_watched": "2021-10-31",

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,76 @@
[
{
"Show Title": "Scavengers Reign"
},
{
"Show Title": "Nazis: A Warning from History"
},
{
"Show Title": "All Watched Over By Machines of Loving Grace"
},
{
"Show Title": "The Trap: What Happend to Our Dream of Freedom"
},
{
"Show Title": "The Corner (2000"
},
{
"Show Title": "When the Levees Broke: A Requiem in Four Acts (2006)"
},
{
"Show Title": "The National Parks: America's Best Idea"
},
{
"Show Title": "On Death Row"
},
{
"Show Title": "Heimat"
},
{
"Show Title": "Heimat II"
},
{
"Show Title": "V (1983)"
},
{
"Show Title": "V: The Final Battle"
},
{
"Show Title": "Dunkirk (2004)"
},
{
"Show Title": "Walking with Dinosaurs: The Ballad of Big Al"
},
{
"Show Title": "Chased by Dinosaurs"
},
{
"Show Title": "I Love Alaska"
},
{
"Show Title": "Nerds 2.0.1: A Brief History of the Internet"
},
{
"Show Title": "World on a Wire"
},
{
"Show Title": "Prohibition (2011)"
},
{
"Show Title": "The Dust Bowl"
},
{
"Show Title": "The Story of Film: An Odyssey"
},
{
"Show Title": "It (1990)"
},
{
"Show Title": "Life with Judy Garland: Me and My Shadows"
},
{
"Show Title": "BBS: The Documentary"
},
{
"Show Title": "Louis Theroux: Miami Mega Jail"
},
{
"Show Title": "Scavengers Reign"
},
{
"Show Title": "The Power of Nightmares: The Rise of the Politics of Fear"
},

View file

@ -6,23 +6,31 @@ from urllib.request import urlopen
def process_items(items):
logging.info("Processing items…")
item_values = {}
for i, item in enumerate(items):
item_values = {
'date_added': item['Date Added'],
'date_watched': item['Date Watched']
}
if 'Rewatch' in item: item_values['is_rewatch'] = item['Rewatch']
if 'Comments' in item: item_values['comments'] = item['Comments']
if 'id' not in item:
if 'Date Added' in item:
item_values['date_added'] = item['Date Added']
del item['Date Added']
if 'Date Watched' in item:
item_values['date_watched'] = item['Date Watched']
del item['Date Watched']
if 'Rewatch' in item:
item_values['is_rewatch'] = item['Rewatch']
del item['Rewatch']
if 'Comments' in item:
item_values['comments'] = item['Comments']
del item['Comments']
if 'IMDB ID' in item:
items[i] = populate_from_id(item)
else:
items[i] = populate_from_details(item)
if 'IMDB ID' in item:
items[i] = populate_from_id(item)
else:
items[i] = populate_from_details(item)
items[i] |= item_values
items[i] |= item_values
with open("../data/films/log.json", "w") as films_log:
with open("../data/films/wishlist.json", "w") as films_log:
json.dump(items, films_log, indent=4)
logging.info("Finished processing items")
@ -55,17 +63,22 @@ def populate_from_details(item):
response_data = json.loads(response.text)
if len(response_data['results']) > 1:
response_data['results'] = [film for film in response_data['results'] if film['title'] == item['Title']]
if len(response_data['results']) > 1:
logging.warning(f"Returned more than one film for {item['Title']}")
return item
if len(response_data['results']) > 0:
if 1 == len(response_data['results']):
film = response_data['results'][0]
return cleanup_film(film)
elif 0 == len(response_data['results']):
logging.warning(f"Returned no results for {item['Title']} ({item['Release Year']})")
elif 1 < len(response_data['results']):
response_data['results'] = [film for film in response_data['results'] if film['title'] == item['Title']]
if 1 < len(response_data['results']):
logging.warning(f"Returned more than one film for {item['Title']} ({item['Release Year']})")
item['IMDB ID'] = input(f"Enter IMDB ID for {item['Title']} ({item['Release Year']}):")
if item['IMDB ID'] != '':
return populate_from_id(item)
else:
logging.warning(f"Returning no results for {item['Title']}")
logging.warning(f"Skipped {item['Title']} ({item['Release Year']})")
return item
@ -122,7 +135,7 @@ def cleanup_film(film):
logging.basicConfig(filename='run.log', encoding='utf-8', level=logging.DEBUG)
with open("../data/films/log.json", "r") as films_log:
with open("../data/films/wishlist.json", "r") as films_log:
films = json.load(films_log)
process_items(films)

147
scripts/run.log Normal file
View file

@ -0,0 +1,147 @@
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing ID (Hated: GG Allin & The Murder Junkies)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/?external_source=imdb_id HTTP/1.1" 404 None
ERROR:root:{"success":false,"status_code":34,"status_message":"The resource you requested could not be found."}
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing ID (Hated: GG Allin & The Murder Junkies)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/?external_source=imdb_id HTTP/1.1" 404 None
ERROR:root:{"success":false,"status_code":34,"status_message":"The resource you requested could not be found."}
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing Hated: GG Allin & The Murder Junkies…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Hated%3A+GG+Allin+%26+The+Murder+Junkies&include_adult=True&year=1994 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned no results for Hated: GG Allin & The Murder Junkies (1994)
INFO:root:Processing ID tt0107086 (Hated: GG Allin & The Murder Junkies)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0107086?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID tt0065908 (Jak rozpętałem drugą wojnę światową)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0065908?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for Jak rozpętałem drugą wojnę światową
INFO:root:Processing Martin…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Martin&include_adult=True&year=1976 HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID tt0077914 (Martin)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0077914?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID (Safe House)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/?external_source=imdb_id HTTP/1.1" 404 None
ERROR:root:{"success":false,"status_code":34,"status_message":"The resource you requested could not be found."}
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing Hated: GG Allin & The Murder Junkies…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Hated%3A+GG+Allin+%26+The+Murder+Junkies&include_adult=True&year=1994 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned no results for Hated: GG Allin & The Murder Junkies (1994)
INFO:root:Processing ID tt0107086 (Hated: GG Allin & The Murder Junkies)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0107086?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID tt0065908 (Jak rozpętałem drugą wojnę światową)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0065908?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for Jak rozpętałem drugą wojnę światową
INFO:root:Processing Martin…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Martin&include_adult=True&year=1976 HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID tt0077914 (Martin)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0077914?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing Safe House…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Safe+House&include_adult=True&year=2012 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned more than one film for Safe House (2012)
WARNING:root:Skipped Safe House (2012)
INFO:root:Finished processing items
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing ID tt0065908 (Jak rozpętałem drugą wojnę światową)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0065908?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for Jak rozpętałem drugą wojnę światową
INFO:root:Processing Safe House…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Safe+House&include_adult=True&year=2012 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned more than one film for Safe House (2012)
WARNING:root:Skipped Safe House (2012)
INFO:root:Finished processing items
INFO:root:Processing items…
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing ID tt0065908 (Jak rozpętałem drugą wojnę światową)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0065908?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for Jak rozpętałem drugą wojnę światową
INFO:root:Processing Safe House…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Safe+House&include_adult=True&year=2012 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned more than one film for Safe House (2012)
INFO:root:Processing ID tt1599348 (Safe House)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt1599348?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
INFO:root:Finished processing items
INFO:root:Processing items…
INFO:root:Processing How Not to Make a Movie…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=How+Not+to+Make+a+Movie&include_adult=True&year=2013 HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returned no results for How Not to Make a Movie (2013)
INFO:root:Processing ID tt4053592 (How Not to Make a Movie)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt4053592?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for How Not to Make a Movie
INFO:root:Processing Jak rozpętałem drugą wojnę światową…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/search/movie?query=Jak+rozp%C4%99ta%C5%82em+drug%C4%85+wojn%C4%99+%C5%9Bwiatow%C4%85&include_adult=True&year=1970 HTTP/1.1" 200 None
INFO:root:200
INFO:root:Processing ID tt0065908 (Jak rozpętałem drugą wojnę światową)…
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.themoviedb.org:443
DEBUG:urllib3.connectionpool:https://api.themoviedb.org:443 "GET /3/find/tt0065908?external_source=imdb_id HTTP/1.1" 200 None
INFO:root:200
WARNING:root:Returning no results for Jak rozpętałem drugą wojnę światową
INFO:root:Finished processing items

13582
scripts/run.log.bak Normal file

File diff suppressed because it is too large Load diff