Wrote new calls to just get poster and bg

pull/2093/head
Anojh 7 years ago
parent 8520528087
commit 5370afd32a

@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { AuthService } from "../auth/auth.service";
import { ImageService, IssuesService, NotificationService, SearchService, SettingsService } from "../services";
import { ImageService, IssuesService, NotificationService, SettingsService } from "../services";
import { DomSanitizer } from "@angular/platform-browser";
import { IIssues, IIssuesChat, IIssueSettings, INewIssueComments, IssueStatus } from "../interfaces";
@ -34,7 +34,6 @@ export class IssueDetailsComponent implements OnInit {
private settingsService: SettingsService,
private notificationService: NotificationService,
private imageService: ImageService,
private searchService: SearchService,
private sanitizer: DomSanitizer) {
this.route.params
.subscribe((params: any) => {
@ -94,19 +93,21 @@ export class IssueDetailsComponent implements OnInit {
private setBackground(issue: any) {
if (issue.requestType === 1) {
this.searchService.getMovieInformation(Number(issue.providerId)).subscribe(x => {
this.imageService.getMovieBackground(Number(issue.providerId)).subscribe(x => {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + "https://image.tmdb.org/t/p/w1280" + x.backdropPath + ")");
this.posterPath = "https://image.tmdb.org/t/p/w300/" + x.posterPath;
("url(" + x + ")");
});
this.imageService.getMoviePoster(Number(issue.providerId)).subscribe(x => {
this.posterPath = x.toString();
});
} else {
this.imageService.getTvBanner(Number(issue.providerId)).subscribe(x => {
this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")");
});
this.searchService.getShowInformationTreeNode(Number(issue.providerId)).subscribe(x => {
this.posterPath = x.data.banner;
this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => {
this.posterPath = x.toString();
});
}

@ -20,4 +20,20 @@ export class ImageService extends ServiceHelpers {
public getTvBanner(tvdbid: number): Observable<string> {
return this.http.get<string>(`${this.url}tv/${tvdbid}`, {headers: this.headers});
}
public getTvBackground(tvdbid: number): Observable<string> {
return this.http.get<string>(`${this.url}background/tv/${tvdbid}`, { headers: this.headers });
}
public getTvPoster(tvdbid: number): Observable<string> {
return this.http.get<string>(`${this.url}poster/tv/${tvdbid}`, { headers: this.headers });
}
public getMovieBackground(themoviedb: number): Observable<string> {
return this.http.get<string>(`${this.url}movies/${themoviedb}`, { headers: this.headers });
}
public getMoviePoster(themoviedb: number): Observable<string> {
return this.http.get<string>(`${this.url}poster/movies/${themoviedb}`, { headers: this.headers });
}
}

@ -41,6 +41,15 @@ namespace Ombi.Controllers
{
return images.tvbanner.FirstOrDefault()?.url ?? string.Empty;
}
return string.Empty;
}
[HttpGet("background/tv/{tvdbid}")]
public async Task<string> GetTvBackground(int tvdbid)
{
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await Api.GetTvImages(tvdbid, key.Value);
if (images.showbackground != null)
{
return images.showbackground.FirstOrDefault()?.url ?? string.Empty;
@ -48,6 +57,45 @@ namespace Ombi.Controllers
return string.Empty;
}
[HttpGet("poster/tv/{tvdbid}")]
public async Task<string> GetTvPoster(int tvdbid)
{
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await Api.GetTvImages(tvdbid, key.Value);
if (images.tvposter != null)
{
return images.tvposter.FirstOrDefault()?.url ?? string.Empty;
}
return string.Empty;
}
[HttpGet("movies/{themoviedb}")]
public async Task<string> GetMovieBackground(int themoviedb)
{
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await Api.GetMovieImages(themoviedb, key.Value);
if (images.moviebackground != null)
{
return images.moviebackground.FirstOrDefault()?.url ?? string.Empty;
}
return string.Empty;
}
[HttpGet("poster/movies/{themoviedb}")]
public async Task<string> GetMoviePoster(int themoviedb)
{
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await Api.GetMovieImages(themoviedb, key.Value);
if (images.movieposter != null)
{
return images.movieposter.FirstOrDefault()?.url ?? string.Empty;
}
return string.Empty;
}
[HttpGet("background")]
public async Task<object> GetBackgroundImage()
{

@ -80,7 +80,7 @@ module.exports = (env: any) => {
},
plugins: [
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", Hammer: "hammerjs/hammer" }), // Global identifiers
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, './client')), // Workaround for https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, "./client")), // Workaround for https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/14898
extractCSS,

Loading…
Cancel
Save