""" Usage Examples: ### Search ### ** Returns a list of items Searched for from TMDB Search TMDB search ### Movies ### ** Returns a list of Now Playing Movies TMDB Movies Now Playing movies/now_playing ** Returns a list of the TMDB Most Popular Movies TMDB Popular Movies movies/popular ** Returns a list of the TMDB Top Rated Movies TMDB Top Rated Movies movies/top_rated ** Returns upcoming movies, then Trailers for the movies. Second Tag must be movie/upcoming TMDB Upcoming Movies movie/upcoming Shows Trailers For Upcoming Movies ** Returns a list of the TMDB Popular People Movies. Results show only Movie Titles currently. TMDB Popular People Movies people/popular ** Returns a list of the TMDB Movies by a specific Year. Must change Year at the end Of the Second Tag. Movies Released In 2018 year/movies/2018 ** Returns a list of Movies by a specific Genre. Must change Genre ID at the end Of the Second Tag. TMDB Action Movies genre/movies/28 ** Returns a list of Movies by a Specific Actor. Must change Actor ID at the end Of the Second Tag. Al Pacino person/movies/1158 ** Returns a list of Movies by a Production Companies. Must change Production Company ID at the end Of the Second Tag. Pixar Animation company/movies/3 ** Returns a list of a specific Movie Collection. Must change Movie Collection ID at the end Of the Second Tag. TMDB Star Wars Collection collection/10 ** Returns a list of Movies by a specific Keyword. Must change Keyword ID at the end of the Second Tag. TMDB Army Movies keyword/movies/6092 ** Returns the Trailer for a specific Movie. Must change Movie Trailer ID at the end of the Second Tag. Star Wars: The Last Jedi TRAILER trailer/181808 ### TV Shows ### ** Returns a list of TV Shows Airing Today TMDB Shows Airing Today tv/today ** Returns a list of the TMDB Popular TV Shows TMDB Popular Shows tv/popular ** Returns a list of the TMDB Top Rated TV Shows TMDB Top Rated Shows tv/top_rated ** Returns a list of the TMDB TV Shows Airing in the Next 7 Days TMDB Shows On The Air tv/on_the_air ** Returns a list of the TMDB TV Shows by Genre. Must change Genre ID at the end of the second Tag TMDB Animation Shows genre/shows/16 ** Returns a list of the TMDB TV Shows by Network. Must change Network ID at the end of the second Tag ABC network/shows/2 ** Returns a list of the TMDB TV Shows by Actor. Must change Actor ID at the end of the second Tag TMDB Bryan Cranston Shows person/shows/17419 ** Returns a list of the TMDB TV Shows by a specific Keyword. Must change Keyword ID At The End Of The Second Tag TMDB King Shows keyword/shows/13084 ** Returns a list of the TMDB Animal Kingdom TV Shows. Must change List ID at the end of the second Tag TMDB List: Animal Kingdom list/13488 ------------------------------------------------------------- """ from resources.modules import public import logging addDir3=public.addDir3 def run(url,lang,icon,fanart,plot,name): url=url.replace('movies','movie').replace('tv/today','tv/airing_today') id='' if 'year/movie' in url: url2='https://api.themoviedb.org/3/discover/movie?api_key=34142515d9d23817496eeb4ff1d223d0&language=%s&sort_by=popularity.desc&include_adult=false&include_video=false&primary_release_year=%s&with_original_language=en&page=1'%(lang,url.split('year/movie/')[1]) mode=14 elif 'company/movie/' in url: split_url = url.split("/") if len(split_url) == 3: split_url.append(1) company_id = split_url[-2] url2='https://api.themoviedb.org/3/discover/movie?api_key=34142515d9d23817496eeb4ff1d223d0&with_companies={0}&language={1}&sort_by=popularity.desc&timezone=America%2FNew_York&include_null_first_air_dates=false&page=1'.format(company_id,lang) mode=14 elif 'keyword' in url: split_url = url.split("/") if len(split_url) == 3: split_url.append(1) keyword_id = split_url[-2] media = split_url[-3] if media == "movie": s_type='movie' else: s_type='tv' url2='http://api.themoviedb.org/3/discover/%s?with_keywords=%s&api_key=34142515d9d23817496eeb4ff1d223d0&language=%s&page=1'%(s_type,keyword_id,lang) mode=14 elif 'collection/' in url: split_url = url.split("/") id = split_url[-1] url2='http://api.themoviedb.org/3/%s?api_key=34142515d9d23817496eeb4ff1d223d0&language=%s&page=1'%(url,lang) mode=179 elif 'network' in url: split_url = url.split("/") if len(split_url) == 3: split_url.append(1) network_id = split_url[-2] url2='https://api.themoviedb.org/3/discover/tv?api_key=34142515d9d23817496eeb4ff1d223d0&with_networks={0}&language={1}&sort_by=popularity.desc&timezone=America%2FNew_York&include_null_first_air_dates=false&page=1'.format(network_id,lang) mode=14 elif 'genre' in url: split_url = url.split("/") if len(split_url) == 3: split_url.append(1) genre_id = split_url[-2] media = split_url[-3] if media == "movie": s_type='movie' else: s_type='tv' url2='http://api.themoviedb.org/3/discover/%s?api_key=34142515d9d23817496eeb4ff1d223d0&sort_by=popularity.desc&with_genres=%s&language=%s&page=1'%(s_type,genre_id,lang) mode=14 elif 'list/' in url: id = url.split("/")[-1] url2='http://api.themoviedb.org/3/%s?api_key=34142515d9d23817496eeb4ff1d223d0&language=%s&page=1'%(url,lang) mode=192 elif 'people/popular' in url: url2='www' mode=72 elif 'person' in url: split_url = url.split("/") url2 = split_url[-1] plot = split_url[-2] mode=73 elif 'trailer/' in url: id = url.split("/")[-1] url2='movie' mode=25 plot='play_now' elif 'search' in url: mode=5 url2='www' else: url2='http://api.themoviedb.org/3/%s?api_key=34142515d9d23817496eeb4ff1d223d0&language=%s&page=1'%(url,lang) mode=14 return addDir3(name,url2,mode,icon,fanart,plot,id=id)