-
+
+
diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts
index 6daeb5dec..07889499f 100644
--- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts
+++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts
@@ -1,11 +1,10 @@
import { Component, OnDestroy, OnInit } from "@angular/core";
+import { DomSanitizer } from "@angular/platform-browser";
import { Router } from "@angular/router";
import { Subject } from "rxjs/Subject";
import { AuthService } from "../auth/auth.service";
-import { NotificationService } from "../services";
-import { RequestService } from "../services";
-import { SearchService } from "../services";
+import { ImageService, NotificationService, RequestService, SearchService} from "../services";
import { TreeNode } from "primeng/primeng";
import { IRequestEngineResult } from "../interfaces";
@@ -27,10 +26,11 @@ export class TvSearchComponent implements OnInit, OnDestroy {
private subscriptions = new Subject
();
constructor(private searchService: SearchService, private requestService: RequestService,
- private notificationService: NotificationService, private route: Router, private authService: AuthService) {
+ private notificationService: NotificationService, private route: Router, private authService: AuthService,
+ private imageService: ImageService, private sanitizer: DomSanitizer) {
this.searchChanged
- .debounceTime(600) // Wait Xms afterthe last event before emitting last event
+ .debounceTime(600) // Wait Xms after the last event before emitting last event
.distinctUntilChanged() // only emit if value is different from previous value
.takeUntil(this.subscriptions)
.subscribe(x => {
@@ -130,6 +130,13 @@ export class TvSearchComponent implements OnInit, OnDestroy {
public getExtraInfo() {
this.tvResults.forEach((val, index) => {
+
+ this.imageService.getTvBanner(val.data.id).subscribe(x => {
+
+ val.data.background = this.sanitizer.
+ bypassSecurityTrustStyle
+ ("linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%),url(" + x + ")");
+ });
this.searchService.getShowInformationTreeNode(val.data.id)
.takeUntil(this.subscriptions)
.subscribe(x => {
@@ -203,6 +210,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
this.tvResults[index].data.seasonRequests = updated.data.seasonRequests;
this.tvResults[index].data.seriesId = updated.data.seriesId;
this.tvResults[index].data.fullyAvailable = updated.data.fullyAvailable;
+ this.tvResults[index].data.backdrop = updated.data.backdrop;
}
}
diff --git a/src/Ombi/ClientApp/app/services/image.service.ts b/src/Ombi/ClientApp/app/services/image.service.ts
index 337b297bc..8175cf9e0 100644
--- a/src/Ombi/ClientApp/app/services/image.service.ts
+++ b/src/Ombi/ClientApp/app/services/image.service.ts
@@ -15,4 +15,8 @@ export class ImageService extends ServiceHelpers {
public getRandomBackground(): Observable {
return this.http.get(`${this.url}background/`, { headers: this.headers }).map(this.extractData);
}
+
+ public getTvBanner(tvdbid: number): Observable {
+ return this.http.get(`${this.url}tv/${tvdbid}`, { headers: this.headers }).map(this.extractData);
+ }
}
diff --git a/src/Ombi/ClientApp/styles/base.scss b/src/Ombi/ClientApp/styles/base.scss
index 6be03820e..fb5fc0552 100644
--- a/src/Ombi/ClientApp/styles/base.scss
+++ b/src/Ombi/ClientApp/styles/base.scss
@@ -842,4 +842,12 @@ a > h4:hover {
.backdrop{
box-shadow: 3px 3px 10px #000000;
background-position: center;
+ background-size: cover;
}
+
+.tv-overview{
+ -webkit-text-fill-color: white;
+ -webkit-text-stroke-width: 0.3px;
+ -webkit-text-stroke-color: black;
+ font-size: 0.9rem !important
+}
\ No newline at end of file
diff --git a/src/Ombi/Controllers/ImagesController.cs b/src/Ombi/Controllers/ImagesController.cs
index 7e698eb97..6efd2f83c 100644
--- a/src/Ombi/Controllers/ImagesController.cs
+++ b/src/Ombi/Controllers/ImagesController.cs
@@ -5,8 +5,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Ombi.Config;
+using Ombi.Helpers;
namespace Ombi.Controllers
{
@@ -14,16 +17,32 @@ namespace Ombi.Controllers
[Produces("application/json")]
public class ImagesController : Controller
{
- public ImagesController(IFanartTvApi api, IApplicationConfigRepository config, IOptions options)
+ public ImagesController(IFanartTvApi api, IApplicationConfigRepository config,
+ IOptions options, IMemoryCache c)
{
Api = api;
Config = config;
Options = options.Value;
+ _cache = c;
}
private IFanartTvApi Api { get; }
private IApplicationConfigRepository Config { get; }
private LandingPageBackground Options { get; }
+ private readonly IMemoryCache _cache;
+
+ [HttpGet("tv/{tvdbid}")]
+ public async Task GetTvBanner(int tvdbid)
+ {
+ var key = await _cache.GetOrCreateAsync(CacheKeys.FanartTv, async entry =>
+ {
+ entry.SlidingExpiration = TimeSpan.FromDays(1);
+ return await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
+ });
+
+ var images = await Api.GetTvImages(tvdbid, key.Value);
+ return images.tvbanner.FirstOrDefault()?.url ?? string.Empty;
+ }
[HttpGet("background")]
public async Task