Ejemplo n.º 1
0
def fetch_film_by_title(filmaster_film):
    """
       Function takes Filmaster movie object,
       try to fetch movie object from tmdb and returns it
    """
    localized = filmaster_film.get_localized_film('en')
    titles = localized and localized.title and (localized.title, ) or ()
    if not filmaster_film.title in titles:
        titles += (filmaster_film.title, )
    for title in titles:
        if filmaster_film.release_year:
            results = search(title + " %s" % filmaster_film.release_year)
            for result in results:
                if match(filmaster_film, result):
                    return result

        results = search(title)
        for result in results:
            if match(filmaster_film, result):
                return result
        for result in results:
            if match(filmaster_film, result, fuzzy=True):
                return result
Ejemplo n.º 2
0
def fetch_film_by_title(filmaster_film):
    """
       Function takes Filmaster movie object,
       try to fetch movie object from tmdb and returns it
    """
    localized = filmaster_film.get_localized_film('en')
    titles = localized and localized.title and (localized.title, ) or ()
    if not filmaster_film.title in titles:
        titles += (filmaster_film.title, )
    for title in titles:
        if filmaster_film.release_year:
            results = search(title + " %s" % filmaster_film.release_year)
            for result in results:
                if match(filmaster_film, result):
                    return result
        
        results = search(title)
        for result in results:
            if match(filmaster_film, result):
                return result
        for result in results:
            if match(filmaster_film, result, fuzzy=True):
                return result
Ejemplo n.º 3
0
 def get_movie_urls(self, title, year=None):
     """
         Returns tmdb movie instance instead of url to movie
     """
     try:
         s = "Fetching: " + title
         results = tmdb.search(title)
         for result in results:
             logger.debug('Trying to fetch synopsis for: %s' % title )
             film_to_fetch = result
             prod_date = film_to_fetch['released']
             if prod_date:
                 production_year, month, day = prod_date.split("-")
                 if year == int(production_year):
                     tmdb_film = tmdb.getMovieInfo(film_to_fetch['id'])
                     logger.debug('Found in tmdb: %s' % tmdb_film["name"])
                     return [{'url': tmdb_film }]
     except Exception, e:
         logger.exception(e)
Ejemplo n.º 4
0
 def get_movie_urls(self, title, year=None):
     """
         Returns tmdb movie instance instead of url to movie
     """
     try:
         s = "Fetching: " + title
         results = tmdb.search(title)
         for result in results:
             logger.debug('Trying to fetch synopsis for: %s' % title)
             film_to_fetch = result
             prod_date = film_to_fetch['released']
             if prod_date:
                 production_year, month, day = prod_date.split("-")
                 if year == int(production_year):
                     tmdb_film = tmdb.getMovieInfo(film_to_fetch['id'])
                     logger.debug('Found in tmdb: %s' % tmdb_film["name"])
                     return [{'url': tmdb_film}]
     except Exception, e:
         logger.exception(e)