def tmdb_tv_search(term, page_no): from modules.history import add_to_search_history add_to_search_history(term, 'tvshow_queries') string = "%s_%s_%s" % ('tmdb_tv_search', term, page_no) url = 'https://api.themoviedb.org/3/search/tv?api_key=%s&language=en-US&query=%s&page=%s' % ( tmdb_api, term, page_no) return cache_object(get_tmdb, string, url, expiration=4)
def tmdb_people_biography(actor_id, language=None): if not language: from tikimeta.utils import get_language language = get_language() string = "%s_%s_%s" % ('tmdb_people_biography', actor_id, language) url = 'https://api.themoviedb.org/3/person/%s?api_key=%s&language=%s' % ( actor_id, tmdb_api, language) return cache_object(get_tmdb, string, url)
def user_cloud(self, folder_id=None): if folder_id: string = "fen_pm_user_cloud_%s" % folder_id url = "folder/list?id=%s" % folder_id else: string = "fen_pm_user_cloud_root" url = "folder/list" return cache_object(self._get, string, url, False, 2)
def tmdb_movies_title_year(title, year=None): if year: string = "%s_%s_%s" % ('tmdb_movies_title_year', title, year) url = 'https://api.themoviedb.org/3/search/movie?api_key=%s&language=en-US&query=%s&year=%s' % ( tmdb_api, title, year) else: string = "%s_%s" % ('tmdb_movies_title_year', title) url = 'https://api.themoviedb.org/3/search/movie?api_key=%s&language=en-US&query=%s' % ( tmdb_api, title) return cache_object(get_tmdb, string, url, expiration=672) # month
def get_hosts(self): hosts_dict = {'Premiumize.me': []} hosts = [] string = "fen_pm_valid_hosts" url = "services/list" try: result = cache_object(self._get, string, url, False, 8) for x in result['directdl']: for alias in result['aliases'][x]: hosts.append(alias.split('.')[0]) hosts_dict['Premiumize.me'] = list(set(hosts)) except: pass return hosts_dict
def get_hosts(self): hosts_dict = {'Real-Debrid': []} hosts = [] string = "fen_rd_valid_hosts" url = "hosts/status" try: result = cache_object(self._get, string, url, False, 8) for k, v in result.items(): # if v['status'] == 'up' and v['supported'] == 1: if v['supported'] == 1: hosts.append(k.split('.')[0]) hosts_dict['Real-Debrid'] = list(set(hosts)) except: pass return hosts_dict
def get_hosts(self): hosts_dict = {'AllDebrid': []} hosts = [] url = 'hosts' string = "fen_ad_valid_hosts" try: result = cache_object(self._get, string, url, False, 8) if result.get('success', False): for i in result['hosts']: if i['status']: hosts.append(i['domain'].split('.')[0]) if 'altDomains' in i: for alt in i['altDomains']: hosts.append(alt.split('.')[0]) hosts_dict['AllDebrid'] = list(set(hosts)) except: pass return hosts_dict
def cast(self): key = 'cast' if self._action(key) in ('clear', None): return from apis.tmdb_api import get_tmdb from modules.fen_cache import cache_object result = None actor_id = None search_name = None search_name = dialog.input('FEN DISCOVER: Enter Actor/Actress Name', type=xbmcgui.INPUT_ALPHANUM) if not search_name: return string = "%s_%s" % ('tmdb_movies_people_search_actor_data', search_name) url = 'https://api.themoviedb.org/3/search/person?api_key=%s&language=en-US&query=%s' % (tmdb_api, search_name) result = cache_object(get_tmdb, string, url, 4) result = result['results'] if not result: return actor_list = [] if len(result) > 1: for item in result: name = item['name'] known_for_list = [i.get('title', 'NA') for i in item['known_for']] known_for_list = [i for i in known_for_list if not i == 'NA'] known_for = '[I]%s[/I]' % ', '.join(known_for_list) if known_for_list else '[I]Movie Actor[/I]' listitem = xbmcgui.ListItem(name, known_for) listitem.setArt({'icon': 'http://image.tmdb.org/t/p/w185/%s' % item['profile_path']}) listitem.setProperty('id', str(item['id'])) listitem.setProperty('name', name) actor_list.append(listitem) selection = dialog.select("FEN DISCOVER: Select Correct Actor/Actress", actor_list, useDetails=True) if selection >= 0: actor_id = int(actor_list[selection].getProperty('id')) actor_name = actor_list[selection].getProperty('name') else: self._set_property() else: actor_id = [item['id'] for item in result][0] actor_name = [item['name'] for item in result][0] if actor_id: try: values = ('&with_cast=%s' % str(actor_id), actor_name.decode('ascii', 'ignore')) except: values = ('&with_cast=%s' % str(actor_id), actor_name) self._process(key, values)
def tmdb_movies_top_rated(page_no): string = "%s_%s" % ('tmdb_movies_top_rated', page_no) url = 'https://api.themoviedb.org/3/movie/top_rated?api_key=%s&language=en-US&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_movies_in_theaters(page_no): string = "%s_%s" % ('tmdb_movies_in_theaters', page_no) url = 'https://api.themoviedb.org/3/movie/now_playing?api_key=%s&language=en-US&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_movies_latest_releases(page_no): current_date, previous_date = get_dates(31, reverse=True) string = "%s_%s" % ('tmdb_movies_latest_releases', page_no) url = 'https://api.themoviedb.org/3/discover/movie?api_key=%s&language=en-US®ion=US&release_date.gte=%s&release_date.lte=%s&with_release_type=4|5&page=%s' % ( tmdb_api, previous_date, current_date, page_no) return cache_object(get_tmdb, string, url)
def tmdb_people_info(query): string = "%s_%s" % ('tmdb_people_info', query) url = 'https://api.themoviedb.org/3/search/person?api_key=%s&language=en-US&query=%s&page=1' % ( tmdb_api, query) return cache_object(get_tmdb, string, url, expiration=4)['results']
def tmdb_movies_blockbusters(page_no): string = "%s_%s" % ('tmdb_movies_blockbusters', page_no) url = 'https://api.themoviedb.org/3/discover/movie?api_key=%s&language=en-US&sort_by=revenue.desc&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def user_cloud_info(self, file_id): string = "fen_rd_user_cloud_info_%s" % file_id url = "torrents/info/%s" % file_id return cache_object(self._get, string, url, False)
def tmdb_tv_airing_today(page_no): string = "%s_%s" % ('tmdb_tv_airing_today', page_no) url = 'https://api.themoviedb.org/3/tv/airing_today?api_key=%s&timezone=America/Edmonton&language=en-US&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url, expiration=24)
def tmdb_movies_upcoming(page_no): current_date, future_date = get_dates(31, reverse=False) string = "%s_%s" % ('tmdb_movies_upcoming', page_no) url = 'https://api.themoviedb.org/3/discover/movie?api_key=%s&language=en-US®ion=US&release_date.gte=%s&release_date.lte=%s&with_release_type=3|2|1&page=%s' % ( tmdb_api, current_date, future_date, page_no) return cache_object(get_tmdb, string, url)
def user_cloud(self): string = "fen_rd_user_cloud" url = "torrents" return cache_object(self._get, string, url, False, 2)
def tmdb_tv_recommendations(tmdb_id, page_no): string = "%s_%s_%s" % ('tmdb_tv_recommendations', tmdb_id, page_no) url = 'https://api.themoviedb.org/3/tv/%s/recommendations?api_key=%s&language=en-US&page=%s' % ( tmdb_id, tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_tv_actor_roles(actor_id): string = "%s_%s" % ('tmdb_tv_actor_roles', actor_id) url = 'https://api.themoviedb.org/3/person/%s/tv_credits?api_key=%s&language=en-US' % ( int(actor_id), tmdb_api) return cache_object(get_tmdb, string, url, expiration=4)['cast']
def tmdb_tv_similar(tmdb_id, page_no): string = "%s_%s_%s" % ('tmdb_tv_similar', tmdb_id, page_no) url = 'https://api.themoviedb.org/3/tv/%s/similar?api_key=%s&language=en-US&page=%s' % ( tmdb_id, tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_tv_networks(network_id, page_no): string = "%s_%s_%s" % ('tmdb_tv_networks', network_id, page_no) url = 'https://api.themoviedb.org/3/discover/tv?api_key=%s&language=en-US&sort_by=popularity.desc&include_null_first_air_dates=false&with_networks=%s&page=%s' % ( tmdb_api, network_id, page_no) return cache_object(get_tmdb, string, url)
def tmdb_tv_genres_by_year(genre_id, year, page_no): string = "%s_%s_%s_%s" % ('tmdb_tv_genres_by_year', genre_id, year, page_no) url = 'https://api.themoviedb.org/3/discover/tv?api_key=%s&with_genres=%s&first_air_date_year=%s&sort_by=popularity.desc&include_null_first_air_dates=false&page=%s' % ( tmdb_api, genre_id, year, page_no) return cache_object(get_tmdb, string, url)
def tmdb_movies_discover(query, page_no): string = query % page_no url = query % page_no return cache_object(get_tmdb, string, url)
def tmdb_tv_on_the_air(page_no): string = "%s_%s" % ('tmdb_tv_on_the_air', page_no) url = 'https://api.themoviedb.org/3/tv/on_the_air?api_key=%s&language=en-US&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_movies_genres(genre_id, page_no): string = "%s_%s_%s" % ('tmdb_movies_genres', genre_id, page_no) url = 'https://api.themoviedb.org/3/discover/movie?api_key=%s&with_genres=%s&sort_by=popularity.desc&page=%s' % ( tmdb_api, genre_id, page_no) return cache_object(get_tmdb, string, url)
def tmdb_company_id(query): string = "%s_%s" % ('tmdb_company_id', query) url = 'https://api.themoviedb.org/3/search/company?api_key=%s&query=%s' % ( tmdb_api, query) return cache_object(get_tmdb, string, url, expiration=168)
def downloads(self): string = "fen_rd_downloads" url = "downloads" return cache_object(self._get, string, url, False, 2)
def tmdb_popular_people(page_no): string = "%s_%s" % ('tmdb_popular_people', page_no) url = 'https://api.themoviedb.org/3/person/popular?api_key=%s&language=en-US&page=%s' % ( tmdb_api, page_no) return cache_object(get_tmdb, string, url)
def tmdb_people_pictures(actor_id): string = "%s_%s" % ('tmdb_images_person', actor_id) url = 'https://api.themoviedb.org/3/person/%s/images?api_key=%s' % ( actor_id, tmdb_api) return cache_object(get_tmdb, string, url)
def tmdb_tv_upcoming(page_no): current_date, future_date = get_dates(31, reverse=False) string = "%s_%s" % ('tmdb_tv_upcoming', page_no) url = 'https://api.themoviedb.org/3/discover/tv?api_key=%s&language=en-US&sort_by=popularity.desc&first_air_date.gte=%s&first_air_date.lte=%s&page=%s' % ( tmdb_api, current_date, future_date, page_no) return cache_object(get_tmdb, string, url)