def search_movie_advanced(self, title=None, adult=None, results=None, sort=None, sort_dir=None): """Return a list of Movie objects for a query for the given title. The results argument is the maximum number of results to return.""" if results is None: results = self._results try: results = int(results) except (ValueError, OverflowError): results = 20 res = self._search_movie_advanced(title=title, adult=adult, results=results, sort=sort, sort_dir=sort_dir) return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ][:results]
def get_top50_animation_movies(self): res = self._get_top_bottom_movies('topanimation50') return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ]
def get_bottom100_movies(self): """Return the list of the bottom 100 movies.""" res = self._get_top_bottom_movies('bottom') return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ]
def get_top250_indian_movies(self): """Return the list of the top 250 indian movies.""" res = self._get_top_bottom_movies('topindian250') return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ]
def get_popular100_tv(self): """Return the list of the 100 most popular tv shows.""" res = self._get_top_bottom_movies('tvmeter') return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ]
def get_movie_list(self, list_, results=None): """Return a list of Movie objects for a list id as input """ res = self._get_movie_list(list_, results) return [ Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res ][:results]
def new_movie(self, *arguments, **keywords): """Return a Movie object.""" # XXX: not really useful... if keywords.has_key('title'): if not isinstance(keywords['title'], UnicodeType): keywords['title'] = unicode(keywords['title'], encoding, 'replace') elif len(arguments) > 1: if not isinstance(arguments[1], UnicodeType): arguments[1] = unicode(arguments[1], encoding, 'replace') return Movie.Movie(accessSystem=self.accessSystem, *arguments, **keywords)
def get_keyword(self, keyword, results=None): """Return a list of movies for the given keyword.""" if results is None: results = self._keywordsResults try: results = int(results) except (ValueError, OverflowError): results = 100 res = self._get_keyword(keyword, results) return [Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res][:results]
def new_movie(self, *arguments, **keywords): """Return a Movie object.""" # XXX: not really useful... if 'title' in keywords: if not isinstance(keywords['title'], str): keywords['title'] = str(keywords['title'], encoding, 'replace') elif len(arguments) > 1: if not isinstance(arguments[1], str): arguments[1] = str(arguments[1], encoding, 'replace') return Movie.Movie(accessSystem=self.accessSystem, *arguments, **keywords)
def get_keyword(self, keyword, results=None): """Return a list of movies for the given keyword.""" if results is None: results = self._keywordsResults try: results = int(results) except (ValueError, OverflowError): results = 100 # XXX: I suppose it will be much safer if the user provides # an unicode string... this is just a guess. if not isinstance(keyword, unicode): keyword = unicode(keyword, encoding, 'replace') res = self._get_keyword(keyword, results) return [Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res][:results]
def search_movie(self, title, results=None, _episodes=False): """Return a list of Movie objects for a query for the given title. The results argument is the maximum number of results to return.""" if results is None: results = self._results try: results = int(results) except (ValueError, OverflowError): results = 20 if not _episodes: res = self._search_movie(title, results) else: res = self._search_episode(title, results) return [Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res][:results]
def get_movie(self, movieID, info=Movie.Movie.default_info, modFunct=None): """Return a Movie object for the given movieID. The movieID is something used to univocally identify a movie; it can be the imdbID used by the IMDb web server, a file pointer, a line number in a file, an ID in a database, etc. info is the list of sets of information to retrieve. If specified, modFunct will be the function used by the Movie object when accessing its text fields (like 'plot').""" movieID = self._normalize_movieID(movieID) movieID = self._get_real_movieID(movieID) movie = Movie.Movie(movieID=movieID, accessSystem=self.accessSystem) modFunct = modFunct or self._defModFunct if modFunct is not None: movie.set_mod_funct(modFunct) self.update(movie, info) return movie
def search_movie(self, title, results=None, _episodes=False): """Return a list of Movie objects for a query for the given title. The results argument is the maximum number of results to return.""" if results is None: results = self._results try: results = int(results) except (ValueError, OverflowError): results = 20 # XXX: I suppose it will be much safer if the user provides # an unicode string... this is just a guess. if not isinstance(title, UnicodeType): title = unicode(title, encoding, 'replace') if not _episodes: res = self._search_movie(title, results) else: res = self._search_episode(title, results) return [Movie.Movie(movieID=self._get_real_movieID(mi), data=md, modFunct=self._defModFunct, accessSystem=self.accessSystem) for mi, md in res][:results]
def new_movie(self, *arguments, **keywords): """Return a Movie object.""" # XXX: not really useful... return Movie.Movie(accessSystem=self.accessSystem, *arguments, **keywords)
# get a movie and print its director(s) the_matrix = ia.get_movie('0133093') for director in the_matrix['directors']: print(director['name']) # # show all information that are currently available for a movie print(sorted(the_matrix.keys())) # # show all information sets that can be fetched for a movie print(ia.get_movie_infoset()) # update a Movie object with more information ia.update(the_matrix, ['technical']) # show which keys were added by the information set print(the_matrix.infoset2keys['technical']) # print one of the new keys print(the_matrix.get('runtime')) print(imdb.helpers.fullSizeCoverURL(the_matrix)) m1 = Movie("Avengers") print(m1.getID) # search_results = ia.search_movie('A Star Is Born (2018)') # if search_results: # movieID = search_results[0].movieID # movie = ia.get_movie(movieID) # if movie: # cast = movie.get('cast') # topActors = 5 # for actor in cast[:topActors]: # print("{0} as {1}".format(actor['name'], actor.currentRole))