Python Forum
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cinemagoer library problem
#16
Ok, this is another try I came up with. Three of the movies have not been released or production has not started
With all the queries, it takes a minute to get results
First it test for a year in the original call, if year is None, it test from a movie call using the movieID. If there is a KeyError, set a default value. I checked the production date of the three with no year. They are not in production or may not be produced.

from imdb import Cinemagoer
from pandas import DataFrame
from tabulate import tabulate


ia = Cinemagoer()
arg = 'angelina jolie'
people = ia.search_person(arg)
person = people[0]
person = ia.get_person(person.personID)
jobs = [job for job in person['filmography'].keys()]
movies = [movie for movie in person['filmography'][jobs[0]]]


data = []
for stuff in movies:
    if stuff.get('year') != None:
        year = stuff.get('year')
    else:
        if ia.get_movie(stuff.movieID).get('year'):
            year = ia.get_movie(stuff.movieID).get('year')
        else:
            year = 'No Release Date Available'
    data.append((stuff.get('title'), str(year), stuff.movieID))
data.sort(key=lambda date: date[1])
headers = ['Movie', 'Release', 'Movie ID']
show = tabulate(DataFrame(data), headers=headers, tablefmt='pretty', showindex=False, colalign=('left', 'left', 'left'))
print(show)
output
Output:
+----------------------------------------------+---------------------------+----------+ | Movie | Release | Movie ID | +----------------------------------------------+---------------------------+----------+ | Lookin' to Get Out | 1982 | 0084268 | | Antonello Venditti: Alta marea | 1990 | 7307196 | | Lenny Kravitz: Stand by My Woman | 1991 | 9145838 | | Alice & Viril | 1993 | 0356342 | | Angela & Viril | 1993 | 0356360 | | The Lemonheads: It's About Time | 1993 | 9145946 | | Widespread Panic: Wonderin' | 1993 | 13381208 | | Cyborg 2: Glass Shadow | 1993 | 0106639 | | Meat Loaf: Bat Out of Hell II - Picture Show | 1994 | 0364980 | | Meat Loaf: Rock and Roll Dreams Come Through | 1994 | 7023152 | | Without Evidence | 1995 | 0176326 | | Hackers | 1995 | 0113243 | | Mojave Moon | 1996 | 0117070 | | Foxfire | 1996 | 0116353 | | Love Is All There Is | 1996 | 0116928 | | Playing God | 1997 | 0119906 | | The Rolling Stones: Anybody Seen My Baby? | 1997 | 6762286 | | George Wallace | 1997 | 0119189 | | True Women | 1997 | 0118499 | | Playing by Heart | 1998 | 0145734 | | Hell's Kitchen | 1998 | 0129136 | | Gia | 1998 | 0123865 | | Girl, Interrupted | 1999 | 0172493 | | The Bone Collector | 1999 | 0145681 | | Pushing Tin | 1999 | 0120797 | | Gone in 60 Seconds | 2000 | 0187078 | | Billy Bob Thornton: Angelina | 2001 | 13381238 | | Original Sin | 2001 | 0218922 | | Lara Croft: Tomb Raider | 2001 | 0146316 | | Life or Something Like It | 2002 | 0282687 | | Beyond Borders | 2003 | 0294357 | | Korn: Did My Time | 2003 | 8661174 | | Lara Croft: Tomb Raider - The Cradle of Life | 2003 | 0325703 | | Alexander | 2004 | 0346491 | | The Fever | 2004 | 0368725 | | Shark Tale | 2004 | 0307453 | | Sky Captain and the World of Tomorrow | 2004 | 0346156 | | Taking Lives | 2004 | 0364045 | | Mr. & Mrs. Smith | 2005 | 0356910 | | The Good Shepherd | 2006 | 0343737 | | Stars in Their Eyes Kids | 2006 | 0363377 | | Beowulf | 2007 | 0442933 | | Entourage | 2007 | 0387199 | | A Mighty Heart | 2007 | 0829459 | | Wanted | 2008 | 0493464 | | Changeling | 2008 | 0824747 | | Kung Fu Panda | 2008 | 0441773 | | The Tourist | 2010 | 1243957 | | Kung Fu Panda Holiday | 2010 | 1702433 | | Salt | 2010 | 0944835 | | Kung Fu Panda: Secrets of the Masters | 2011 | 1980162 | | Kung Fu Panda 2 | 2011 | 1302011 | | Kung Fu Panda Po's Winter Wonderland | 2012 | 21360350 | | Maleficent | 2014 | 1587310 | | By the Sea | 2015 | 3707106 | | Kung Fu Panda 3 | 2016 | 2267968 | | Mon Guerlain: Notes of a Woman | 2017 | 9110568 | | Maleficent: Mistress of Evil | 2019 | 4777008 | | The One and Only Ivan | 2020 | 3661394 | | Come Away | 2020 | 5714470 | | Eternals | 2021 | 9032400 | | Those Who Wish Me Dead | 2021 | 3215824 | | Kung Fu Panda 4 | 2024 | 21692408 | | Every Note Played | No Release Date Available | 11351272 | | Maleficent 3 | No Release Date Available | 15410560 | | Maria | No Release Date Available | 22893404 |
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
cinemagoer library problem - by lunacy90 - Sep-04-2023, 06:19 PM
RE: cinemagoer library problem - by menator01 - Sep-04-2023, 06:28 PM
RE: cinemagoer library problem - by deanhystad - Sep-04-2023, 06:45 PM
RE: cinemagoer library problem - by lunacy90 - Sep-04-2023, 07:55 PM
RE: cinemagoer library problem - by deanhystad - Sep-04-2023, 08:15 PM
RE: cinemagoer library problem - by menator01 - Sep-05-2023, 12:59 AM
RE: cinemagoer library problem - by deanhystad - Sep-05-2023, 01:41 AM
RE: cinemagoer library problem - by menator01 - Sep-05-2023, 03:24 AM
RE: cinemagoer library problem - by lunacy90 - Sep-05-2023, 10:12 AM
RE: cinemagoer library problem - by lunacy90 - Sep-05-2023, 10:58 AM
RE: cinemagoer library problem - by menator01 - Sep-07-2023, 04:47 PM
RE: cinemagoer library problem - by lunacy90 - Sep-05-2023, 11:58 AM
RE: cinemagoer library problem - by deanhystad - Sep-05-2023, 12:24 PM
RE: cinemagoer library problem - by lunacy90 - Sep-05-2023, 01:30 PM
RE: cinemagoer library problem - by menator01 - Sep-05-2023, 09:30 PM
RE: cinemagoer library problem - by deanhystad - Sep-05-2023, 10:21 PM
RE: cinemagoer library problem - by menator01 - Sep-05-2023, 11:50 PM
RE: cinemagoer library problem - by menator01 - Sep-06-2023, 08:06 AM
RE: cinemagoer library problem - by lunacy90 - Sep-08-2023, 03:16 PM
RE: cinemagoer library problem - by deanhystad - Sep-07-2023, 06:37 PM
RE: cinemagoer library problem - by menator01 - Sep-07-2023, 06:56 PM
RE: cinemagoer library problem - by menator01 - Sep-08-2023, 04:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with importing python-telegram library into the project gandonio 1 1,639 Nov-01-2022, 02:19 AM
Last Post: deanhystad
  Problem with using Crypto library reks2004 2 2,475 Mar-27-2020, 05:38 AM
Last Post: buran
  Problem installing library thunderspeed 2 2,379 Mar-22-2020, 11:04 PM
Last Post: thunderspeed
  Problem importing resource library ChrisM 8 4,073 Oct-23-2019, 01:40 PM
Last Post: ChrisM
  Problem Using Python Library abir99 8 5,500 Nov-21-2017, 03:12 PM
Last Post: sparkz_alot
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,891 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020