def match_fa_with_imdb(cls, fa_movies, start_time, report_postfix, threaded): match_results = MatchedMoviesList() imdb = imdbHelper.IMDBhelper() imdbNotFound = FAMovieList() print('\nAbout to get imdb ids...\n') alg = ConfigManager.algorithm() if threaded: createTrheadedQueue(target=cls.getImdbIdsThread, args=(imdb, imdbNotFound, match_results, alg), elements=fa_movies) else: for current_fa_movie in fa_movies: MatchAlgorithms.movie_match(current_fa_movie, imdb, match_results, imdbNotFound, alg) # find imdb orphan votes cls.imdb_login(imdb) for a in imdb.votes(): matched = match_results.findImdb(a.code) if matched is None: print('Imdb orphant vote {} {} {}'.format(a.code, a.title, a.year)) if not imdbNotFound.empty(): print("\r\nCaution: ", len(imdbNotFound), " FA movies could not be fount in IMDB!") table_notFound = imdbNotFound.saveReport("FilmsNotFoundAtIMDB", report_postfix) print("Movies not found:") print(table_notFound) print("\r\nAll movies from FA matched with IMDB database.\r\n") print("--- Total runtime %s seconds ---" % (time.time() - start_time)) if ConfigManager.copy_votes_to_imdb(): cls.copy_votes_from_fa_to_imdb(imdb, match_results, report_postfix) return match_results
def getDumpAllVotes(self): numVotes, numPages = self.getNumVotes() print("FOUND: {0} movies in {1} pages.".format(numVotes, numPages)) print("\r\nPushing pages to queue to get all movie information.") common.createTrheadedQueue(lambda queue: self.__faVoteDumper(queue), (), range(1, int(numPages) + 1)) print("\r\nPushing movies to queue to get all movie information.") common.createTrheadedQueue(lambda queue: self.__faFillMovieInfo(queue), (), self.__faMovies) pass
def copy_votes_from_fa_to_imdb(cls, imdb, match_results, postfix): imdbNotVoted = MatchedMoviesList() cls.imdb_login(imdb) createTrheadedQueue(target=cls.voteImdbThread, args=(imdb, imdbNotVoted), elements=match_results.elements()) if len(imdbNotVoted) > 0: print("\r\nCaution: It was not possible to vote ", len(imdbNotVoted), " movies", ' (' + postfix + ')') table_notVoted = imdbNotVoted.saveReportBeauty("FilmsNotVotedAtIMDB", postfix) print("Movies not voted:") print(table_notVoted)
def copy_votes_from_fa_to_imdb(cls, imdb, match_results, postfix): imdbNotVoted = MatchedMoviesList() cls.imdb_login(imdb) createTrheadedQueue(target=cls.voteImdbThread, args=(imdb, imdbNotVoted), elements=match_results.elements()) if len(imdbNotVoted) > 0: print("\r\nCaution: It was not possible to vote ", len(imdbNotVoted), " movies", ' (' + postfix + ')') table_notVoted = imdbNotVoted.saveReportBeauty( "FilmsNotVotedAtIMDB", postfix) print("Movies not voted:") print(table_notVoted)
def match_fa_with_imdb(cls, fa_movies, start_time, report_postfix, threaded): match_results = MatchedMoviesList() imdb = imdbHelper.IMDBhelper() imdbNotFound = FAMovieList() print('\nAbout to get imdb ids...\n') alg = ConfigManager.algorithm() if threaded: createTrheadedQueue(target=cls.getImdbIdsThread, args=(imdb, imdbNotFound, match_results, alg), elements=fa_movies) else: for current_fa_movie in fa_movies: MatchAlgorithms.movie_match(current_fa_movie, imdb, match_results, imdbNotFound, alg) # find imdb orphan votes cls.imdb_login(imdb) for a in imdb.votes(): matched = match_results.findImdb(a.code) if matched is None: print('Imdb orphant vote {} {} {}'.format( a.code, a.title, a.year)) if not imdbNotFound.empty(): print("\r\nCaution: ", len(imdbNotFound), " FA movies could not be fount in IMDB!") table_notFound = imdbNotFound.saveReport("FilmsNotFoundAtIMDB", report_postfix) print("Movies not found:") print(table_notFound) print("\r\nAll movies from FA matched with IMDB database.\r\n") print("--- Total runtime %s seconds ---" % (time.time() - start_time)) if ConfigManager.copy_votes_to_imdb(): cls.copy_votes_from_fa_to_imdb(imdb, match_results, report_postfix) return match_results