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 __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)
Пример #3
0
    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)
Пример #4
0
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