def __init__(self, imdbid, tmdbid=False, original=None): if tmdbid is False and imdbid.startswith('tt') is not True: imdbid = 'tt' + imdbid self.original = original for i in range(3): try: tmdb.configure(tmdb_api_key) self.movie = tmdb.Movie(imdbid) self.HD = None self.title = self.movie.get_title() self.genre = self.movie.get_genres() self.shortdescription = self.movie.get_tagline() self.description = self.movie.get_overview() self.date = self.movie.get_release_date() # Generate XML tags for Actors/Writers/Directors/Producers self.xml = self.xmlTags() break except Exception as e: print "Failed to connect to tMDB, trying again in 20 seconds" print e time.sleep(20)
def tmdbInfo(guessData): tmdb.configure(tmdb_api_key) #print("Title from guess: %s" % guessData["title"]) movies = tmdb.Movies(guessData["title"].encode('ascii', errors='ignore'), limit=4) #print(movies.get_total_results()) for movie in movies.iter_results(): # Identify the first movie in the collection that matches exactly the movie title foundname = ''.join(e for e in movie["title"] if e.isalnum()) origname = ''.join(e for e in guessData["title"] if e.isalnum()) # origname = origname.replace('&', 'and') #print("Info: %s - %s\n" % (foundname, origname)) if foundname.lower() == origname.lower(): tmdb_title = '' tmdbid = 0 print("Matched movie title as: %s %s" % (movie["title"], movie["release_date"])) movie = tmdb.Movie(movie["id"]) if isinstance(movie, dict): tmdbid = movie["id"] tmdb_title = movie["title"] else: tmdbid = movie.get_id() tmdb_title = movie.get_title() return tmdbid, tmdb_title return None
def FILEtoIMDB(file_name): """ Added function by nctiggy. This executes if the nzb does not have the IMDB id appended to the name This does capture all of the movies info not just the IMDB id """ print "CouchPotatoServer did not append the IMDB id to the nzb, guessing instead" # Guessing at the name of the movie using the filename movie_info = guessit.guess_movie_info(file_name) #configuring tmdb to use the supplied api key tmdb.configure(tmdb_api_key) print "Guessed movie title as: %s" % (movie_info["title"]) #Creating a collection of movies from tmdb for the guess movie title movies = tmdb.Movies(movie_info["title"]) #parse through all movies found for movie in movies.iter_results(): #Identify the first movie in the collection that matches exactly the movie title foundname = ''.join(e for e in movie["title"] if e.isalnum()) origname = ''.join(e for e in movie_info["title"] if e.isalnum()) if foundname.lower() == origname.lower(): print "Matched movie title as: %s %s" % (movie["title"], movie["release_date"]) movie = tmdb.Movie(movie["id"]) break #return the imdb id of the movie identified return movie.get_imdb_id()
def __init__(self, imdbid, tmdbid=False, original=None, language='en', logger=None): if logger: self.log = logger else: self.log = logging.getLogger(__name__) if tmdbid: self.log.debug("TMDB ID: %s." % tmdbid) else: self.log.debug("IMDB ID: %s." % imdbid) if tmdbid is False and imdbid.startswith('tt') is not True: imdbid = 'tt' + imdbid self.log.debug("Correcting imdbid to %s." % imdbid) self.imdbid = imdbid self.original = original for i in range(3): try: tmdb.configure(tmdb_api_key, language=language) self.movie = tmdb.Movie(imdbid) self.HD = None self.title = self.movie.get_title() self.genre = self.movie.get_genres() self.shortdescription = self.movie.get_tagline() self.description = self.movie.get_overview() self.date = self.movie.get_release_date() # Generate XML tags for Actors/Writers/Directors/Producers self.xml = self.xmlTags() break except Exception as e: self.log.exception( "Failed to connect to tMDB, trying again in 20 seconds.") time.sleep(20)
def tmdbInfo(guessData): tmdb.configure(tmdb_api_key) movies = tmdb.Movies(guessData["title"].encode('ascii', errors='ignore'), limit=4) for movie in movies.iter_results(): #Identify the first movie in the collection that matches exactly the movie title foundname = ''.join(e for e in movie["title"] if e.isalnum()) origname = ''.join(e for e in guessData["title"] if e.isalnum()) #origname = origname.replace('&', 'and') if foundname.lower() == origname.lower(): print "Matched movie title as: %s %s" % (movie["title"].encode(sys.stdout.encoding, errors='ignore'), movie["release_date"].encode(sys.stdout.encoding, errors='ignore')) movie = tmdb.Movie(movie["id"]) if isinstance(movie, dict): tmdbid = movie["id"] else: tmdbid = movie.get_id() return 2, tmdbid return None
def tmdbInfo(guessData): tmdb.configure(tmdb_api_key) movies = tmdb.Movies(guessData["title"].encode('ascii', errors='ignore'), limit=4) for movie in movies.iter_results(): #Identify the first movie in the collection that matches exactly the movie title foundname = ''.join(e for e in movie["title"] if e.isalnum()) origname = ''.join(e for e in guessData["title"] if e.isalnum()) #origname = origname.replace('&', 'and') if foundname.lower() == origname.lower(): print("Matched movie title as: %s %s" % (movie["title"].encode(sys.stdout.encoding, errors='ignore'), movie["release_date"].encode(sys.stdout.encoding, errors='ignore'))) movie = tmdb.Movie(movie["id"]) if isinstance(movie, dict): tmdbid = movie["id"] else: tmdbid = movie.get_id() return 2, tmdbid return None
def __init__(self, imdbid, tmdbid=False, original=None, language='en', logger=None): if logger: self.log = logger else: self.log = logging.getLogger(__name__) if tmdbid: self.log.debug("TMDB ID: %s." % tmdbid) else: self.log.debug("IMDB ID: %s." % imdbid) if tmdbid is False and imdbid.startswith('tt') is not True: imdbid = 'tt' + imdbid self.log.debug("Correcting imdbid to %s." % imdbid) self.imdbid = imdbid self.original = original for i in range(3): try: tmdb.configure(tmdb_api_key, language=language) self.movie = tmdb.Movie(imdbid) self.HD = None self.title = self.movie.get_title() self.genre = self.movie.get_genres() self.shortdescription = self.movie.get_tagline() self.description = self.movie.get_overview() self.date = self.movie.get_release_date() # Generate XML tags for Actors/Writers/Directors/Producers self.xml = self.xmlTags() break except Exception as e: self.log.exception("Failed to connect to tMDB, trying again in 20 seconds.") time.sleep(20)