(Sep-05-2023, 03:24 AM)menator01 Wrote: Could use filmography but, returns a lot of stuff that I don't know if it even involves jolieone more question, hopefully it will be the last. I try to search via company name with the search_company function. I then pass the definitive name to the get_company function which requests an ID for the parameter. How can i get the ID of the company straight from the search_company function? I tried printing it but i only get the name of the company printed. ive tried a generic movie_id or movieId or id option but i get a KeyError
I think it's the database. I used harrison ford and got movies that he was not in. The years were 1962 and 1967.
Samething with Jason Statham. The database has input year errors.
Here is the ouput for Statham
Output:Jason Statham 0005458 +---------------------------------------+------+---------+ | Title | Year | ID | +---------------------------------------+------+---------+ | The Italian Job | 1969 | 0064505 | | Lock, Stock and Two Smoking Barrels | 1998 | 0120735 | | The Bank Job | 2008 | 0200465 | | Snatch | 2000 | 0208092 | | Turn It Up | 2000 | 0216772 | | Ghosts of Mars | 2001 | 0228333 | | The One | 2001 | 0267804 | | Mean Machine | 2001 | 0291341 | | The Transporter | 2002 | 0293662 | | The Italian Job | 2003 | 0317740 | | Death Race | 2008 | 0452608 | | Crank | 2006 | 0479884 | | War | 2007 | 0499556 | | Crank: High Voltage | 2009 | 1121931 | | The Expendables | 2010 | 1320253 | | Fast & Furious 6 | 2013 | 1905041 | | Homefront | 2013 | 2312718 | | Furious 7 | 2015 | 2820852 | | Spy | 2015 | 3079380 | | The Fate of the Furious | 2017 | 4630562 | | Fast & Furious Presents: Hobbs & Shaw | 2019 | 6806448 | +---------------------------------------+------+---------+
my code follows
this is the function that gets all the results based by the name to find the correct company name which the user is looking for.
for i in range(len(search)): if messagebox.askokcancel(title=f"Company Name",message=f"Is {search[i]} the company you are looking for?"): id=search[i] print(id) get_data_company(id)the above function loads another function that will follow below
def get_data_company(id): print(id) company=cg.get_company(str(id)) print(company["name"])the elements i have yet to add to this function are the name retrievals from the films and i want to create a new list of the 10 most recent films made by the company that the user is looking for
EDIT: i set up the search by actor name function. It works ok but there is a small problem. I splice the actors filmography to get the first 10 films sorted by release year but it doesnt actually contain the newest ones. For example i searched for Keanu Reeves and his newest film in the list was Matrix Revolutions not John Wick Chapter 4 as it is in real life. My code follows below
def get_data_actor_name(id): data=[] global cg search = cg.search_person(id) person=search[0] filmography=cg.get_person_biography(id) for film in filmography["titlesRefs"].values(): try: year=film["year"] except KeyError: year="No date available" data.append((film["title"],year)) data.sort(key=lambda a: a[1]) data.reverse() headers=["Movie","Year"] filmography=data[:10] messagebox.showinfo(title=f"{search}'s latest film information", message=f"{headers}\n" f"{filmography[0]}\n" f"{filmography[1]}\n" f"{filmography[2]}\n" f"{filmography[3]}\n" f"{filmography[4]}\n" f"{filmography[5]}\n" f"{filmography[6]}\n" f"{filmography[7]}\n" f"{filmography[8]}\n" f"{filmography[9]}\n" f"")