Exemple #1
0
def popular_movies(request):
    movie = Movie()
    popular = movie.popular()
    trailers = []
    keys = []

    products = []

    for p in popular:
        videos = movie.videos(p.id)
        trailers.append(videos)

    for t in trailers:
        for i in t:
            video_key = i.key
    product = {
        'title': p.title,
        'poster_path': p.poster_path,
        'backdrop_path': p.backdrop_path,
        'duration': p.runtime,
        'year': p.release_date,
        'video': video_key,
    }

    return keys
def import_cast(start, end):
    movie = Movie()
    cast_list = []
    for index in range(start, end):
        try:
            m = movie.credits(index)['cast']
            for i in m:
                try:
                    actor_id = i['id']
                    movie_id = index
                    identity = "Act: " + i['character']
                    c = DbCast(movie_id=movie_id,
                               actor_id=actor_id,
                               identity=identity)
                    cast_list.append(c)
                    print(movie_id, actor_id, identity)
                except TypeError:
                    pass
            k = movie.credits(index)['crew']
            for j in k:
                try:
                    actor_id = j['id']
                    movie_id = index
                    identity = "Produce: " + j['job']
                    c = DbCast(movie_id=movie_id,
                               actor_id=actor_id,
                               identity=identity)
                    cast_list.append(c)
                    print(movie_id, actor_id, identity)
                except TypeError:
                    pass
        except TMDbException:
            pass
    return cast_list
Exemple #3
0
def findMovies(request):
    baseURL = "https://image.tmdb.org/t/p/w300/"
    movieName = request.GET['search field']
    recommended_movies = main_code(movieName)
    movie = Movie()
    movie_poster = []
    new_movie_list = []
    for title in recommended_movies:
        m = re.match(r'^(.*) \((19\d\d|20\d\d)\)$', title)
        name, year = m.groups()
        new_movie_list.append(name)

    for i in new_movie_list:
        print(i)
    count = 0
    flag = True
    for i in new_movie_list:
        if count < 6:
            try:
                search = movie.search(i)
                item = search[0].poster_path
            except IndexError:
                return render(request, "error.html")

            movie_poster_path = str(item)
            final = baseURL + movie_poster_path
            movie_poster.append(final)
            print(final)
            count += 1
        else:
            break

    return render(request, "output.html", {'movie_poster': movie_poster})
def search_movie(request):
    if request.method == 'GET':
        form = FilmSearchForm()
        return render(request, 'save_search.html', {'form': form})
    elif request.method == 'POST':
        form = FilmSearchForm(request.POST)
        if form.is_valid():
            tmdb = TMDb()
            tmdb.api_key = os.environ['KEY-MDB']
            movie = Movie()
            query = request.POST.get('query', 'Marlina')
            search = movie.search(query)

            db, token, uid = initializationDb()
            for p in search:
                data = {
                    "id": p.id,
                    "title": p.title,
                    "overview": p.overview,
                    "poster_path": p.poster_path,
                    "release_date": p.release_date,
                    "popularity": p.popularity,
                    "original_title": p.original_title,
                    "vote_count": p.vote_count,
                    "vote_average": p.vote_average
                }
                db.child(uid).child("movie_list").child(p.id).set(data, token)
            response = {"status": 200, "message": "Success Save"}
            return JsonResponse(response)
        else:
            response = {"status": 401, "message": "Invalid Input"}
            return JsonResponse(response)
Exemple #5
0
    def getMovies(self):
        tmdb = TMDb()
        tmdb.api_key = '1dc5bcb73c0781470cb348d5e02a05a5'
        tmdb.language = 'en'
        tmdb.debug = False

        movie = Movie()
        self.movie = movie
        self.popular = movie.popular()
        self.now = movie.now_playing()
        self.top = movie.top_rated()

        discover = Discover()
        self.movie_discovered = discover.discover_movies(
            {'sort_by': 'vote_average.desc'})

        lists = [self.top, self.now, self.popular, self.movie_discovered]
        self.all_movies = []

        for li in lists:
            for m in li:
                exist = False
                for r in self.all_movies:
                    if r.id == m.id:
                        exist = True
                if (not exist):
                    self.all_movies.append(m)
def popular_movie(request):
    if request.method == 'GET':
        return render(request, 'search_popular.html')
    elif request.method == 'POST':
        tmdb = TMDb()
        tmdb.api_key = os.environ['KEY-MDB']
        movie = Movie()
        popular = movie.popular()

        db, token, uid = initializationDb()
        db.child("movie_popular").remove(token)
        for p in popular:
            data = {
                "id": p.id,
                "title": p.title,
                "overview": p.overview,
                "poster_path": p.poster_path,
                "release_date": p.release_date,
                "popularity": p.popularity,
                "original_title": p.original_title,
                "vote_count": p.vote_count,
                "vote_average": p.vote_average
            }
            db.child(uid).child("movie_popular").child(p.id).set(data, token)
        response = {"status": 200, "message": "Success Save"}
        return JsonResponse(response)
 def __init__(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = "e00b72174e4ae097af808f34a8f220fc"
     self.tv = TV()
     self.season = Season()
     self.movie = Movie()
     self.discover = Discover()
Exemple #8
0
def search_movie(query):
    tmdb = TMDb()
    tmdb.api_key = 'PLEASE GENERATE UR OWN API KEY, ALL INFO IN README FILE'
    movie = Movie()

    result = movie.search(query)
    number_of_movies = len(result)

    if number_of_movies == 0:
        print("SORRY, I CAN'T FIND ANYTHING, PLEASE TRY ANOTHER PHRASE")
    else:
        random_movie_title = choice(result).title
        print(
            f'I have found {number_of_movies} movies, here is a random choice for you:'
        )
        print(f'Title: {random_movie_title}')
        for res in result:
            if res.title == random_movie_title:
                if res.overview == "":
                    print('Sorry, no plot available :c')
                else:
                    print(f'Movie id: {res.id}')
                    print(f'Plot: {res.overview}')
                    print(f'Released in {res.release_date}')

                    similar = movie.similar(res.id)
                    for sim in similar:
                        print(
                            f'Similar movie: {sim} (movie id: {sim.id}), released in {sim.release_date}'
                        )
                        break
                break
Exemple #9
0
 def __init__(self, language: str):
     self.tmdb = TMDb()
     self.tmdb.api_key = config.MOVIE_DB_API_KEY  # '26e13c6a960c2e640f5e1867b9c52a46'
     self.tmdb.language = language or settings.LANGUAGE_CODE
     self.movie = Movie()
     self.discover = Discover()
     self.genre = Genre()
Exemple #10
0
    def add_poster(self, movie_title):
        import requests
        from PyQt5.QtGui import QIcon, QPixmap
        from tmdbv3api import TMDb
        from tmdbv3api import Movie
        tmdb = TMDb()
        tmdb.api_key = '1437062848d1dda19bd3907cf120e9f4'
        tmdb.language = 'en'
        #tmdb.debug = True
        movie = Movie()
        m = movie.search(movie_title)
        for i in m:
            continue_path = i.poster_path
            if continue_path != "None":
                continue_path = i.poster_path
                #print(continue_path)
                break

        url = 'http://image.tmdb.org/t/p/w185'
        combine = url + continue_path
        #readlink
        href = combine
        r = requests.get(href, stream=True)

        pixmap = QPixmap()
        pixmap.loadFromData(r.content)

        self.poster.setPixmap(pixmap)
        self.poster.setScaledContents(True)  #fullsizepic
        self.poster.show()
Exemple #11
0
def main(request):
	movie = Movie()
	d = Discover()
	popular_movies = serialize_movie_array(movie.popular(),10)
	playing_now = serialize_movie_array(movie.now_playing(),10)
	hindi_movies = serialize_hindi_movie(d.discover_movies({"with_original_language":"hi",'vote_count.gte': 100, 'sort_by': 'vote_average.desc'})[:10])
	return render(request, 'index.html', {'popular_movies':popular_movies, 'playing_now':playing_now, 'hindi_movies':hindi_movies})
    def __init__(self, movieId):
        self.movie = movies.loc[(movies['movieId'] == movieId)].max()

        self.title, self.year = sep_year_title(self.movie.title)
        self.id = movieId
        self.genres = self.movie.genres.split('|')
        self.tmdb_id = links.loc[(links['movieId'] == self.id)].max().tmdbId

        try:
            movie = Movie()
            details = movie.details(self.tmdb_id)
            self.title = details.title
            self.poster_url = 'http://image.tmdb.org/t/p/w500/' + details.poster_path
            self.overview = details.overview
            self.release_date = details.release_date
            self.runtime = details.runtime
            self.budget = details.budget
            self.revenue = details.revenue
            self.popularity = details.popularity
        except:
            self.poster_url = None
            self.overview = 'Not Found'
            self.release_date = None
            self.runtime = 0
            self.budget = 0
            self.revenue = 0
            self.popularity = 0
def tmdb_get_movies(config_path, plex, data):
    try:
        tmdb_id = re.search('.*?(\\d+)', data)
        tmdb_id = tmdb_id.group(1)
    except AttributeError:  # Bad URL Provided
        return

    t_movie = Movie()
    tmdb = Collection()
    tmdb.api_key = config_tools.TMDB(
        config_path).apikey  # Set TMDb api key for Collection
    if tmdb.api_key == "None":
        raise KeyError("Invalid TMDb API Key")
    t_movie.api_key = tmdb.api_key  # Copy same api key to Movie
    t_col = tmdb.details(tmdb_id)
    t_movs = []
    for tmovie in t_col.parts:
        t_movs.append(tmovie['id'])

    # Create dictionary of movies and their guid
    # GUIDs reference from which source Plex has pulled the metadata
    p_m_map = {}
    p_movies = plex.Library.all()
    for m in p_movies:
        guid = m.guid
        if "themoviedb://" in guid:
            guid = guid.split('themoviedb://')[1].split('?')[0]
        elif "imdb://" in guid:
            guid = guid.split('imdb://')[1].split('?')[0]
        else:
            guid = "None"
        p_m_map[m] = guid

    matched = []
    missing = []
    # We want to search for a match first to limit TMDb API calls
    # Too many rapid calls can cause a momentary block
    # If needed in future maybe add a delay after x calls to let the limit reset
    for mid in t_movs:  # For each TMBd ID in TMBd Collection
        match = False
        for m in p_m_map:  # For each movie in Plex
            if "tt" not in p_m_map[
                    m] != "None":  # If the Plex movie's guid does not start with tt
                if int(p_m_map[m]) == int(mid):
                    match = True
                    break
        if not match:
            imdb_id = t_movie.details(mid).entries['imdb_id']
            for m in p_m_map:
                if "tt" in p_m_map[m]:
                    if p_m_map[m] == imdb_id:
                        match = True
                        break
        if match:
            matched.append(m)
        else:
            missing.append(t_movie.details(mid).entries['imdb_id'])

    return matched, missing
def import_review(movie_id, review_count):
    movie = Movie()
    try:
        review = movie.reviews(movie_id)
        if len(review) < review_count or len(review) == 0: return None
        return review[review_count - 1]
    except TMDbException:
        pass
Exemple #15
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ['TMDB_API_KEY']
     self.tmdb.language = "en"
     self.tmdb.debug = True
     self.tmdb.wait_on_rate_limit = True
     self.tmdb.cache = False
     self.movie = Movie()
Exemple #16
0
def search(request):
	if request.method == "POST":
		movie = Movie()
		results = serialize_movie_array(movie.search(request.POST["search"]),5)
		if len(results)>5:
			return JsonResponse({"results":results[:5]})
		else:
			return JsonResponse({"results":results})
 def __init__(self):
     '''
     A custom client for The Movie Database API for French movies
     '''
     self.client = TMDb()
     self.client.language = 'fr-FR'
     self.movie_db = Movie()
     self.search = Search()
def movid(ti):
  movie = Movie()
  search = movie.search(ti)
  for res in search:

    x = (res.id)
    break
  return x
Exemple #19
0
def search(query, limit):
    movie = Movie()
    s = movie.search(query)
    first_result = s[0]
    recommendations = movie.recommendations(first_result.id)
    recommendations = recommendations[:int(
        limit)] if recommendations >= limit else recommendations
    for recommendation in recommendations:
        print("%s (%s)" % (recommendation.title, recommendation.release_date))
Exemple #20
0
def add_movie(request, movie_name):
    movie = Movie()
    found_movie = movie.search(movie_name)[0]
    poster_path = found_movie.poster_path[1:]
    print(poster_path)
    new_film = Film(title=movie_name, poster_path=poster_path)
    new_film.save()
    Profile.objects.get(user=request.user).films_list.add(new_film)
    return redirect('/')
Exemple #21
0
def top_rated(request):
    if request.method == 'GET':
        movie = Movie()
        latest = movie.top_rated()

        results = transformer.transform(latest)

        return Response.ok(results)
    else:
        return Response.badRequest(message="invalid request")
def get_recommendation():
    movie = Movie()
    recommendation = random.choice(movie.popular())
    return {
        "title": recommendation.title,
        "overview": recommendation.overview,
        "vote": str(recommendation.vote_average) + "/10",
        "poster":
        "https://image.tmdb.org/t/p/w1280" + recommendation.poster_path
    }
Exemple #23
0
def popular(request):
    if request.method == 'GET':
        movie = Movie()
        popular = movie.popular()

        results = transformer.transform(popular)

        return Response.ok(results)
    else:
        return Response.badRequest(message="Invalid request")
Exemple #24
0
    def movie_message(message):
        try:
            movie = Movie()
            popular = movie.popular()

            # Reply message with recs
            bot.reply_to(message, message_output_shows(show_details(popular)))

        except:
            bot.reply_to(message, "Service is down. Please try again later.")
Exemple #25
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ['api_key']
     self.movie = Movie()
     self.discover = Discover()
     self.tv = TV()
     self.person = Person()
     self.collection = Collection()
     self.company = Company()
     self.season = Season()
Exemple #26
0
def get_recommend(parameters):
    movie = Movie()
    search = tmdb.Search()
    response = search.movie(query=parameters['movie_name'])
    idd = response['results'][0]['id']
    recommendations = movie.recommendations(idd)
    ans = ''
    for recommendation in recommendations:
        ans += (recommendation.title + "\n")
    return ans
Exemple #27
0
def movie_show(request):
    movie = Movie()

    populars = movie.popular()
    print(populars)

    context = {
        'movie': populars,
    }
    return render(request, 'movie/index.html', context)
def fetch():
    projectpath = request.form['projectFilepath']
    id = request.args.get(projectpath)
    print(id)
    movie = Movie()
    m = movie.details(343611)
    url = "http://image.tmdb.org/t/p/w500/" + m.poster_path
    response = requests.get(url)
    img = Image.open(BytesIO(response.content))
    img.save('static/movie.jpg')
    return render_template("image.html")
Exemple #29
0
def tvdb_get_tmdb(config_path, tvdb_id):
    movie = Movie()
    movie.api_key = config_tools.TMDB(config_path).apikey
    search = movie.external(external_id=tvdb_id,
                            external_source="tvdb_id")['tv_results']
    if len(search) == 1:
        try:
            return str(search[0]['id'])
        except IndexError:
            return None
    else:
        return None
Exemple #30
0
    def query_api(self, name):
        tmdb = TMDb()
        tmdb.api_key = tmdb_key
        tmdb.language = 'en'

        #search movies
        movie = Movie()
        search_movie = movie.search(name)
        
        for res in search_movie:
            try:
                Media.objects.get(external_id=res.id)
                continue
            except Media.DoesNotExist as ex:
                if res.release_date == '':
                    res.release_date = None
                if res.poster_path == None:
                    poster = "https://lascrucesfilmfest.com/wp-content/uploads/2018/01/no-poster-available-737x1024.jpg"
                else:
                    poster = "https://www.themoviedb.org/t/p/w600_and_h900_bestv2" + res.poster_path
                Media.objects.create(
                    title = res.title,
                    description = res.overview,
                    poster_url = poster,
                    release_date = res.release_date,
                    media_type= "Movie",
                    external_id= res.id
                )


        #search TV
        tv = TV()
        search_tv = tv.search(name)

        for res in search_tv:
            if res.first_air_date == '':
                    res.first_air_date = None
            if res.poster_path == None:
                poster = "https://lascrucesfilmfest.com/wp-content/uploads/2018/01/no-poster-available-737x1024.jpg"
            else:
                poster = "https://www.themoviedb.org/t/p/w600_and_h900_bestv2" + res.poster_path
            try:
                Media.objects.get(external_id=res.id)
                continue
            except Media.DoesNotExist as ex:
                Media.objects.create(
                    title = res.name,
                    description = res.overview,
                    poster_url = poster,
                    release_date = res.first_air_date,
                    media_type= "TV",
                    external_id= res.id
                )
Exemple #31
0
 def search(self, submission):
     movie = Movie()
     title = submission
     if len(title) > 0:
         try:
             search = movie.search(title)
         except Exception as e:
             return
         if len(search) > 0:
             first = search[0]
             try:
                 movie = movie.details(first.id)
             except Exception as e:
                 return
             self.post(movie)
 def __init__(self, option_config_json):
     self.API_KEY = option_config_json['API']['themoviedb']
     self.tmdbv3 = TMDb()
     self.tmdbv3.api_key = self.API_KEY
     tmdb.API_KEY = self.API_KEY
     self.movie = Movie()
     self.tv = TV()
class CommonMetadataTMDB(object):
    """
    Class for interfacing with TMDB
    """

    def __init__(self, option_config_json):
        self.API_KEY = option_config_json['API']['themoviedb']
        self.tmdbv3 = TMDb()
        self.tmdbv3.api_key = self.API_KEY
        tmdb.API_KEY = self.API_KEY
        self.movie = Movie()
        self.tv = TV()

    def com_tmdb_search(self, media_title, media_year=None, id_only=False, media_type='movie'):
        """
        # search for media title and year
        """
        common_global.es_inst.com_elastic_index('info', {"tmdb search": media_title,
                                                         'year': media_year})
        if media_type == 'movie':
            try:
                search = self.movie.search(media_title.replace('\\u25ba', ''))
            except:
                search = self.movie.search(media_title.encode('utf-8'))
        else:  # defaulting to TV search then
            try:
                search = self.tv.search(media_title.replace('\\u25ba', ''))
            except:
                search = self.tv.search(media_title.encode('utf-8'))
        common_global.es_inst.com_elastic_index('info', {'search': str(search)})
        if len(search) > 0:
            for res in search:
                # print(res.id)
                # print(res.title)
                # print(res.overview)
                # print(res.poster_path)
                # print(res.vote_average)
                common_global.es_inst.com_elastic_index('info', {"result": res.title, 'id': res.id,
                                                                 'date':
                                                                     res.release_date.split('-', 1)[
                                                                         0]})
                if media_year is not None and (str(media_year) == res.release_date.split('-', 1)[0]
                                               or str(int(media_year) - 1) ==
                                               res.release_date.split('-', 1)[0]
                                               or str(int(media_year) - 2) ==
                                               res.release_date.split('-', 1)[0]
                                               or str(int(media_year) - 3) ==
                                               res.release_date.split('-', 1)[0]
                                               or str(int(media_year) + 1) ==
                                               res.release_date.split('-', 1)[0]
                                               or str(int(media_year) + 2) ==
                                               res.release_date.split('-', 1)[0]
                                               or str(int(media_year) + 3) ==
                                               res.release_date.split('-', 1)[0]):
                    if not id_only:
                        return 'info', self.com_tmdb_metadata_by_id(res.id)
                    else:
                        return 'idonly', res.id  # , s['title']
            return None, None
            # TODO multimatch......handle better!
            # TODO so, returning None, None for now
            # return 're', search.results
        else:
            return None, None

    def com_tmdb_metadata_by_id(self, tmdb_id):
        """
        Fetch all metadata by id to reduce calls
        """
        if tmdb_id[0:2].lower() == 'tt':
            # imdb id......so, run find and then do the requests
            tmdb_id = metadata_movie.movie_fetch_tmdb_imdb(tmdb_id)
        try:
            return requests.get('https://api.themoviedb.org/3/movie/%s'
                                '?api_key=%s&append_to_response=credits,reviews,release_dates,videos' %
                                (tmdb_id, self.API_KEY))
        except requests.exceptions.ConnectionError:
            time.sleep(20)
            self.com_tmdb_metadata_by_id(tmdb_id)

    def com_tmdb_metadata_tv_by_id(self, tmdb_id):
        """
        Fetch all metadata by id to reduce calls
        """
        try:
            return requests.get('https://api.themoviedb.org/3/tv/%s'
                                '?api_key=%s&append_to_response=credits,reviews,release_dates,videos' %
                                (tmdb_id, self.API_KEY))
        except requests.exceptions.ConnectionError:
            time.sleep(20)
            self.com_tmdb_metadata_tv_by_id(tmdb_id)

    def com_tmdb_metadata_bio_by_id(self, tmdb_id):
        """
        Fetch all metadata bio by id to reduce calls
        """
        try:
            return requests.get('https://api.themoviedb.org/3/person/%s'
                                '?api_key=%s&append_to_response=combined_credits,external_ids,images' %
                                (tmdb_id, self.API_KEY))
        except requests.exceptions.ConnectionError:
            time.sleep(20)
            self.com_tmdb_metadata_bio_by_id(tmdb_id)

    def com_tmdb_meta_bio_image_build(self, thread_db, result_json):
        """
        # download info and set data to be ready for insert into database
        """
        # common_global.es_inst.com_elastic_index('info', {'tmdb bio build': result_json})
        # create file path for poster
        image_file_path = common_metadata.com_meta_image_file_path(result_json['name'],
                                                                   'person')
        # common_global.es_inst.com_elastic_index('info', {'tmdb bio image path': image_file_path})
        if 'profile_path' in result_json and result_json['profile_path'] is not None:
            if not os.path.isfile(image_file_path + result_json['profile_path']):
                if result_json['profile_path'] is not None:
                    if not os.path.isfile(image_file_path):
                        common_network.mk_network_fetch_from_url(
                            'https://image.tmdb.org/t/p/original' + result_json['profile_path'],
                            image_file_path + result_json['profile_path'])
        # set local image json
        return ({'Images': {'themoviedb': image_file_path}})

    def com_tmdb_metadata_id_max(self):
        """
        Grab high metadata id
        """
        return json.loads(common_network.mk_network_fetch_from_url(
            'https://api.themoviedb.org/3/movie/latest'
            '?api_key=%s' % self.API_KEY))['id']

    def com_tmdb_metadata_bio_id_max(self):
        """
        Grab high bios metadata id (person)
        """
        return json.loads(common_network.mk_network_fetch_from_url(
            'https://api.themoviedb.org/3/person/latest'
            '?api_key=%s' % self.API_KEY))['id']

    def com_tmdb_metadata_tv_id_max(self):
        """
        Grab high tv metadata id
        """
        return json.loads(common_network.mk_network_fetch_from_url(
            'https://api.themoviedb.org/3/tv/latest'
            '?api_key=%s' % self.API_KEY))['id']

    def com_tmdb_meta_by_id(self, tmdb_id):
        """
        # movie info by tmdb
        """
        movie = tmdb.Movies(tmdb_id)
        try:
            metadata = movie.info()
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error', {"TMDB Fetch Error": str(err_code)})
            metadata = None
        return metadata

    def com_tmdb_meta_cast_by_id(self, tmdb_id):
        """
        # cast by tmdb
        """
        movie = tmdb.Movies(tmdb_id)
        try:
            metadata = movie.credits()
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error', {"TMDB Fetch Credits Error":
                                                                  str(err_code)})
            metadata = None
        return metadata

    def com_tmdb_meta_review_by_id(self, tmdb_id):
        """
        # review by tmdb
        """
        movie = tmdb.Movies(tmdb_id)
        try:
            metadata = movie.reviews()
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error', {"TMDB Fetch Review Error": str(
                err_code)})
            metadata = None
        return metadata

    def com_tmdb_meta_release_by_id(self, tmdb_id):
        """
        # release by tmdb
        """
        movie = tmdb.Movies(tmdb_id)
        try:
            metadata = movie.releases()
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error',
                                                    {"TMDB Fetch Releases Error": str(err_code)})
            metadata = None
        return metadata

    # TODO
    # The supported external sources for each object are as follows:
    #    Movies: imdb_id
    #    People: imdb_id, freebase_mid, freebase_id
    #    TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id
    #    TV Seasons: freebase_mid, freebase_id, tvdb_id
    #    TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id

    def com_tmdb_meta_by_imdb_id(self, imdb_id):
        """
        # search by imdb
        """
        movie = tmdb.Find(imdb_id)
        try:
            metadata = movie.info(external_source='imdb_id')
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error',
                                                    {"TMDB Fetch imdb Error": str(err_code)})
            metadata = None
        return metadata

    def com_tmdb_meta_changes_movie(self):
        """
        # movie changes since date within 24 hours
        """
        changes = tmdb.Changes()
        movie_changes = changes.movie()
        return movie_changes

    def com_tmdb_meta_changes_tv(self):
        """
        # tv changes since date within 24 hours
        """
        changes = tmdb.Changes()
        tv_changes = changes.tv()
        return tv_changes

    def com_tmdb_meta_changes_person(self):
        """
        # person changes since date within 24 hours
        """
        changes = tmdb.Changes()
        person_changes = changes.person()
        return person_changes

    def com_tmdb_meta_collection_by_id(self, tmdb_id):
        """
        # collection info
        """
        movie_collection = tmdb.Collections(tmdb_id)
        try:
            metadata = movie_collection.info()
        except Exception as err_code:
            common_global.es_inst.com_elastic_index('error',
                                                    {"TMDB Fetch Collection Error": str(err_code)})
            metadata = None
        return metadata

    def com_tmdb_meta_info_build(self, result_json):
        """
        # download info and set data to be ready for insert into database
        """
        # common_global.es_inst.com_elastic_index('info', {'tmdb info build': result_json})
        # create file path for poster
        image_file_path = common_metadata.com_meta_image_file_path(result_json['title'],
                                                                   'poster')
        # common_global.es_inst.com_elastic_index('info', {'tmdb image path': image_file_path})
        poster_file_path = None
        if result_json['poster_path'] is not None:
            image_file_path += result_json['poster_path']
            if not os.path.isfile(image_file_path):
                common_network.mk_network_fetch_from_url('https://image.tmdb.org/t/p/original'
                                                         + result_json['poster_path'],
                                                         image_file_path)
            poster_file_path = image_file_path
        # create file path for backdrop
        image_file_path = common_metadata.com_meta_image_file_path(result_json['title'],
                                                                   'backdrop')
        backdrop_file_path = None
        if result_json['backdrop_path'] is not None:
            image_file_path += result_json['backdrop_path']
            if not os.path.isfile(image_file_path):
                common_network.mk_network_fetch_from_url('https://image.tmdb.org/t/p/original'
                                                         + result_json['backdrop_path'],
                                                         image_file_path)
            backdrop_file_path = image_file_path
        # its a number so make it a string just in case
        series_id_json = json.dumps({'imdb': result_json['imdb_id'],
                                     'themoviedb': str(result_json['id'])})
        # set local image json
        image_json = ({'Images': {'themoviedb': {'Backdrop': backdrop_file_path,
                                                 'Poster': poster_file_path}}})
        return series_id_json, result_json, image_json