mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-31 12:00:06 -07:00
Get the Tv Backdrop !wip
This commit is contained in:
parent
eb755afbcc
commit
4d486e68a5
4 changed files with 105 additions and 5 deletions
|
@ -452,7 +452,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
{
|
{
|
||||||
// Swallow, couldn't parse the date
|
// Swallow, couldn't parse the date
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTitle(sb, $"https://www.imdb.com/title/{info.ImdbId}/", $"{info.Title} {releaseDate}");
|
AddTitle(sb, $"https://www.imdb.com/title/{info.ImdbId}/", $"{info.Title} {releaseDate}");
|
||||||
AddParagraph(sb, info.Overview);
|
AddParagraph(sb, info.Overview);
|
||||||
|
|
||||||
|
@ -529,9 +529,17 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
{
|
{
|
||||||
banner = banner.Replace("http", "https"); // Always use the Https banners
|
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/w500{tvInfo.backdrop_path}");
|
||||||
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
|
||||||
|
}
|
||||||
AddPosterInsideTable(sb, banner);
|
AddPosterInsideTable(sb, banner);
|
||||||
AddMediaServerUrl(sb, t.Url, overlay);
|
AddMediaServerUrl(sb, t.Url, overlay);
|
||||||
AddInfoTable(sb);
|
AddInfoTable(sb);
|
||||||
|
@ -649,8 +657,16 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
banner = banner.Replace("http", "https"); // Always use the Https banners
|
banner = banner.Replace("http", "https"); // Always use the Https banners
|
||||||
}
|
}
|
||||||
|
|
||||||
//GET BACKGROUND URL HERE AND CALL
|
var tvInfo = await _movieApi.GetTVInfo(t.TheMovieDbId);
|
||||||
AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/");
|
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);
|
AddPosterInsideTable(sb, banner);
|
||||||
AddMediaServerUrl(sb, t.Url, overlay);
|
AddMediaServerUrl(sb, t.Url, overlay);
|
||||||
AddInfoTable(sb);
|
AddInfoTable(sb);
|
||||||
|
|
|
@ -18,5 +18,6 @@ namespace Ombi.Api.TheMovieDb
|
||||||
Task<List<MovieSearchResult>> SimilarMovies(int movieId);
|
Task<List<MovieSearchResult>> SimilarMovies(int movieId);
|
||||||
Task<FindResult> Find(string externalId, ExternalSource source);
|
Task<FindResult> Find(string externalId, ExternalSource source);
|
||||||
Task<TvExternals> GetTvExternals(int theMovieDbId);
|
Task<TvExternals> GetTvExternals(int theMovieDbId);
|
||||||
|
Task<TvInfo> GetTVInfo(string themoviedbid);
|
||||||
}
|
}
|
||||||
}
|
}
|
74
src/Ombi.TheMovieDbApi/Models/TvInfo.cs
Normal file
74
src/Ombi.TheMovieDbApi/Models/TvInfo.cs
Normal file
|
@ -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);
|
var result = await Api.Request<TheMovieDbContainer<SearchResult>>(request);
|
||||||
return Mapper.Map<List<MovieSearchResult>>(result.results);
|
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)
|
private static void AddRetry(Request request)
|
||||||
{
|
{
|
||||||
request.Retry = true;
|
request.Retry = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue