Get the Tv Backdrop !wip

pull/2191/head
TidusJar 7 years ago
parent eb755afbcc
commit 4d486e68a5

@ -452,7 +452,7 @@ namespace Ombi.Schedule.Jobs.Ombi
{
// Swallow, couldn't parse the date
}
AddTitle(sb, $"https://www.imdb.com/title/{info.ImdbId}/", $"{info.Title} {releaseDate}");
AddParagraph(sb, info.Overview);
@ -529,9 +529,17 @@ namespace Ombi.Schedule.Jobs.Ombi
{
banner = banner.Replace("http", "https"); // Always use the Https banners
}
var tvInfo = await _movieApi.GetTVInfo(t.TheMovieDbId);
if (tvInfo != null && tvInfo.backdrop_path.HasValue())
{
//GET BACKGROUND URL HERE AND CALL
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w500{tvInfo.backdrop_path}");
}
else
{
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
}
AddPosterInsideTable(sb, banner);
AddMediaServerUrl(sb, t.Url, overlay);
AddInfoTable(sb);
@ -649,8 +657,16 @@ namespace Ombi.Schedule.Jobs.Ombi
banner = banner.Replace("http", "https"); // Always use the Https banners
}
//GET BACKGROUND URL HERE AND CALL
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
var tvInfo = await _movieApi.GetTVInfo(t.TheMovieDbId);
if (tvInfo != null && tvInfo.backdrop_path.HasValue())
{
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w500{tvInfo.backdrop_path}");
}
else
{
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
}
AddPosterInsideTable(sb, banner);
AddMediaServerUrl(sb, t.Url, overlay);
AddInfoTable(sb);

@ -18,5 +18,6 @@ namespace Ombi.Api.TheMovieDb
Task<List<MovieSearchResult>> SimilarMovies(int movieId);
Task<FindResult> Find(string externalId, ExternalSource source);
Task<TvExternals> GetTvExternals(int theMovieDbId);
Task<TvInfo> GetTVInfo(string themoviedbid);
}
}

@ -0,0 +1,74 @@
namespace Ombi.Api.TheMovieDb.Models
{
public class TvInfo
{
public string backdrop_path { get; set; }
public Created_By[] created_by { get; set; }
public int[] episode_run_time { get; set; }
public string first_air_date { get; set; }
public Genre[] genres { get; set; }
public string homepage { get; set; }
public int id { get; set; }
public bool in_production { get; set; }
public string[] languages { get; set; }
public string last_air_date { get; set; }
public string name { get; set; }
public Network[] networks { get; set; }
public int number_of_episodes { get; set; }
public int number_of_seasons { get; set; }
public string[] origin_country { get; set; }
public string original_language { get; set; }
public string original_name { get; set; }
public string overview { get; set; }
public float popularity { get; set; }
public string poster_path { get; set; }
public Production_Companies[] production_companies { get; set; }
public Season[] seasons { get; set; }
public string status { get; set; }
public string type { get; set; }
public float vote_average { get; set; }
public int vote_count { get; set; }
}
public class Created_By
{
public int id { get; set; }
public string name { get; set; }
public int gender { get; set; }
public string profile_path { get; set; }
}
public class Genre
{
public int id { get; set; }
public string name { get; set; }
}
public class Network
{
public string name { get; set; }
public int id { get; set; }
public string logo_path { get; set; }
public string origin_country { get; set; }
}
public class Production_Companies
{
public int id { get; set; }
public string logo_path { get; set; }
public string name { get; set; }
public string origin_country { get; set; }
}
public class Season
{
public string air_date { get; set; }
public int episode_count { get; set; }
public int id { get; set; }
public string name { get; set; }
public string overview { get; set; }
public string poster_path { get; set; }
public int season_number { get; set; }
}
}

@ -129,6 +129,15 @@ namespace Ombi.Api.TheMovieDb
var result = await Api.Request<TheMovieDbContainer<SearchResult>>(request);
return Mapper.Map<List<MovieSearchResult>>(result.results);
}
public async Task<TvInfo> GetTVInfo(string themoviedbid)
{
var request = new Request($"/tv/{themoviedbid}", BaseUri, HttpMethod.Get);
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
AddRetry(request);
return await Api.Request<TvInfo>(request);
}
private static void AddRetry(Request request)
{
request.Retry = true;

Loading…
Cancel
Save