def updateBoxOffice(row): # Get movie's IMDb id from file movieID = re.sub('\D', '', row['const']) print 'Movie ID is:', movieID movieObject = IMDbMovie(movieID, ia) # Retrieve box office info from IMDbPY API #boxOffice = imdbInfo.getBoxOfficeAsDict(movieID) boxOffice = movieObject.getBoxOfficeAsDict() print boxOffice # Update row and return true row.update(boxOffice) return True
def moviesToDict(movieList, encodeTitles): dictList = [] for movie in movieList: movieObj = IMDbMovie(imdbInfo.getMovieID(movie), ia) dictList.append(movieObj.convertToDict(encodeTitles)) return dictList