def compare(self, element, terms):
        if element.type != "Movie":
            log.info("i only work for Movies, i got a %s" % element.type)
            return terms

        tmdb_id = element.getIdentifier('tmdb')
        if not tmdb_id:
            log.info("no tmdb_id found for %s" % element)

            movies = tmdb.Movies(element.name, limit=True)
            for tmdb_movie in movies:
                movie = tmdb_movie
                break
        else:
            movie = tmdb.Movie(tmdb_id)

        if not movie:
            log.info("no movie found in themoviedb for %s" % element)
            return terms

        alts = movie.get_alternative_titles()

        for alternative in alts:
            langconfig = self.c.getConfig("title_language_%s" %
                                          alternative['lang'].lower())
            if langconfig:
                if langconfig.value:
                    terms.append(alternative['title'])

        return terms
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
    #Future can eliminate the calls to IMDB to use this data instead perhaps

    print "CouchPotatoServer did not append the IMDB id to the nzb, guessing instead"
    api_key = "45e408d2851e968e6e4d0353ce621c66"  # You need to get this key from themoviedb.org

    # 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(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
        if movie["title"].lower() == movie_info["title"].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()[2:]
Example #3
0
def tmdb_search(sname):
    if not g_tmdb:
        tmdb_init()
    movies = tmdb.Movies(sname)
    results = []
    for movie in movies:
        results.append(movie)
        if len(results) >= 5:
            break
    return results
Example #4
0
    def searchForElement(self, term=''):
        self.progress.reset()
        mediaType = MediaType.get(MediaType.identifier == 'de.lad1337.movies')
        mtm = common.PM.getMediaTypeManager('de.lad1337.movies')[0]
        fakeRoot = mtm.getFakeRoot(term)

        movies = tmdb.Movies(term, limit=True)

        self.progress.total = movies.get_total_results()
        for tmdbMovie in movies:
            self.progress.addItem()
            self._createMovie(fakeRoot, mediaType, tmdbMovie)

        return fakeRoot
Example #5
0
def find_movies(query):
    """
    Query the movie db. Best results are obtained by "Moviename (year)".

    This will prefer the cache. If its not found in the cache tmdb will
    be queried, which take much more time.

    You can prevent this my running warm_cache() as batch process
    beforhand.
    """
    r = movie_queries.find_one({'_id': query})
    if r:
        print "cache hit for " + query
        return r['result']
    else:
        print "searching tmdb for " + query
        movies = list(tmdb.Movies(query).iter_results())
        movie_queries.insert({'_id': query, 'result': movies})
        return movies
Example #6
0
    def _search(self, search, year):
        movie_id = None
        for name in search:
            movies = tmdb.Movies(title=name, year=year, limit=True).get_ordered_matches()
            log('********************************************************')
            try:
                log(str(isAsciiString(movies[1]['title'])))
            except:
                pass

            if len(movies) > 0:
                best = get_best(movies, search, year)
                if best:
                    index = best['itemIndex']
                    if best['rate'] > 70:
                        movie_id = movies[index][1]['id']

            if movie_id:
                break

        return movie_id
Example #7
0
 def setUp(self):
     tmdb.configure("API_KEY")
     self.movies = tmdb.Movies("The Avengers")
Example #8
0
        j.append(t[i]['id'])
    except:
        print "ERROR %s" % i

for i in j:
    try:
        print tv.show.summary(i)['title']
    except:
        print i

####
# tmdb
# To install: pip install git+https://github.com/doganaydin/themoviedb.git fuzzywuzzy
####
import tmdb
tmdb.configure(api - key)
movies = tmdb.Movies('Simpson')
movies = tmdb.Movies('fantozzi')
a = movies.get_best_match()
m = tmdb.Movie(a[1]['id'])
for m in movies.iter_results():
    print m['title'].encode('utf-8')

#####
# Mutagen
#####
from mutagen.easyid3 import EasyID3
a = EasyID3(
    '/Volumes/Macintosh HD/andrea/JdownloaderScaricati/Violetta (2012)/08 Are you ready for the ride.mp3'
)
print a