pull/2295/head
Jamie Rees 6 years ago
parent d1de3f0888
commit 48c86369a6

@ -117,8 +117,10 @@ export class IssueDetailsComponent implements OnInit {
} else { } else {
this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => { this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => {
if(x) {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")"); ("url(" + x + ")");
}
}); });
this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => { this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => {
if (x.length === 0) { if (x.length === 0) {

@ -88,7 +88,9 @@ export class RecentlyAddedComponent implements OnInit {
this.tv.forEach((t) => { this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
if(p) {
t.posterPath = p; t.posterPath = p;
}
}); });
}); });
}); });
@ -98,7 +100,9 @@ export class RecentlyAddedComponent implements OnInit {
this.tv.forEach((t) => { this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
if(p) {
t.posterPath = p; t.posterPath = p;
}
}); });
}); });
}); });

@ -240,8 +240,10 @@ export class TvRequestsComponent implements OnInit {
("url(https://image.tmdb.org/t/p/w1280" + val.data.background + ")"); ("url(https://image.tmdb.org/t/p/w1280" + val.data.background + ")");
} else { } else {
this.imageService.getTvBanner(val.data.tvDbId).subscribe(x => { this.imageService.getTvBanner(val.data.tvDbId).subscribe(x => {
if(x) {
val.data.background = this.sanitizer.bypassSecurityTrustStyle val.data.background = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")"); ("url(" + x + ")");
}
}); });
} }
} }

@ -138,9 +138,11 @@ export class TvSearchComponent implements OnInit {
public getExtraInfo() { public getExtraInfo() {
this.tvResults.forEach((val, index) => { this.tvResults.forEach((val, index) => {
this.imageService.getTvBanner(val.data.id).subscribe(x => { this.imageService.getTvBanner(val.data.id).subscribe(x => {
if(x) {
val.data.background = this.sanitizer. val.data.background = this.sanitizer.
bypassSecurityTrustStyle bypassSecurityTrustStyle
("url(" + x + ")"); ("url(" + x + ")");
}
}); });
this.searchService.getShowInformationTreeNode(val.data.id) this.searchService.getShowInformationTreeNode(val.data.id)
.subscribe(x => { .subscribe(x => {

@ -35,6 +35,10 @@ namespace Ombi.Controllers
[HttpGet("tv/{tvdbid}")] [HttpGet("tv/{tvdbid}")]
public async Task<string> GetTvBanner(int tvdbid) public async Task<string> GetTvBanner(int tvdbid)
{ {
if (tvdbid <= 0)
{
return string.Empty;
}
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await FanartTvApi.GetTvImages(tvdbid, key.Value); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value);
@ -90,6 +94,10 @@ namespace Ombi.Controllers
[HttpGet("poster/tv/{tvdbid}")] [HttpGet("poster/tv/{tvdbid}")]
public async Task<string> GetTvPoster(int tvdbid) public async Task<string> GetTvPoster(int tvdbid)
{ {
if (tvdbid <= 0)
{
return string.Empty;
}
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await FanartTvApi.GetTvImages(tvdbid, key.Value); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value);
@ -145,6 +153,10 @@ namespace Ombi.Controllers
[HttpGet("background/tv/{tvdbid}")] [HttpGet("background/tv/{tvdbid}")]
public async Task<string> GetTvBackground(int tvdbid) public async Task<string> GetTvBackground(int tvdbid)
{ {
if (tvdbid <= 0)
{
return string.Empty;
}
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await FanartTvApi.GetTvImages(tvdbid, key.Value); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value);

Loading…
Cancel
Save