From 196a33f087fca176e4517fa9c49efeb4783ed736 Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 11 May 2018 16:12:31 -0700 Subject: [PATCH] fix #2234 --- .../ClientApp/app/issues/issueDetails.component.ts | 14 +++++++++++--- .../app/requests/movierequests.component.ts | 14 +++++++++++--- .../ClientApp/app/requests/tvrequests.component.ts | 14 +++++++++++--- .../ClientApp/app/search/moviesearch.component.ts | 14 +++++++++++--- .../ClientApp/app/search/tvsearch.component.ts | 14 +++++++++++--- 5 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts index 1072bedbd..641ca1cf4 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts @@ -25,7 +25,8 @@ export class IssueDetailsComponent implements OnInit { public settings: IIssueSettings; public backgroundPath: any; public posterPath: any; - + public defaultPoster: string; + private issueId: number; constructor(private issueService: IssuesService, @@ -42,6 +43,13 @@ export class IssueDetailsComponent implements OnInit { this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser"); this.settingsService.getIssueSettings().subscribe(x => this.settings = x); + this.settingsService.getOmbi().subscribe(x => { + if (x.baseUrl) { + this.defaultPoster = "../../.." + x.baseUrl + "/images/"; + } else { + this.defaultPoster = "../../../images/"; + } + }); } public ngOnInit() { @@ -99,7 +107,7 @@ export class IssueDetailsComponent implements OnInit { }); this.imageService.getMoviePoster(issue.providerId).subscribe(x => { if (x.length === 0) { - this.posterPath = "../../../images/default_movie_poster.png"; + this.posterPath = this.defaultPoster + "default_movie_poster.png"; } else { this.posterPath = x.toString(); } @@ -112,7 +120,7 @@ export class IssueDetailsComponent implements OnInit { }); this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => { if (x.length === 0) { - this.posterPath = "../../../images/default_tv_poster.png"; + this.posterPath = this.defaultPoster + "default_tv_poster.png"; } else { this.posterPath = x.toString(); } diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index eb53af829..b75339bb1 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -6,7 +6,7 @@ import "rxjs/add/operator/map"; import { Subject } from "rxjs/Subject"; import { AuthService } from "../auth/auth.service"; -import { NotificationService, RadarrService, RequestService } from "../services"; +import { NotificationService, RadarrService, RequestService, SettingsService } from "../services"; import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder } from "../interfaces"; @@ -16,6 +16,7 @@ import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadar }) export class MovieRequestsComponent implements OnInit { public movieRequests: IMovieRequests[]; + public defaultPoster: string; public searchChanged: Subject = new Subject(); public searchText: string; @@ -47,7 +48,8 @@ export class MovieRequestsComponent implements OnInit { private auth: AuthService, private notificationService: NotificationService, private radarrService: RadarrService, - private sanitizer: DomSanitizer) { + private sanitizer: DomSanitizer, + private settingsService: SettingsService) { this.searchChanged .debounceTime(600) // Wait Xms after the last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -63,6 +65,12 @@ export class MovieRequestsComponent implements OnInit { this.movieRequests = m; }); }); + this.defaultPoster = "../../../images/default_movie_poster.png" + this.settingsService.getOmbi().subscribe(x => { + if (x.baseUrl) { + this.defaultPoster = "../../.." + x.baseUrl + "/images/default_movie_poster.png"; + } + }); } public ngOnInit() { @@ -354,7 +362,7 @@ export class MovieRequestsComponent implements OnInit { private setPoster(req: IMovieRequests): void { if (req.posterPath === null) { - req.posterPath = "../../../images/default_movie_poster.png"; + req.posterPath = this.defaultPoster; } else { req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath; } diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 4f67ef8cc..a7c010458 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -11,7 +11,7 @@ import "rxjs/add/operator/distinctUntilChanged"; import "rxjs/add/operator/map"; import { AuthService } from "../auth/auth.service"; -import { NotificationService, RequestService, SonarrService } from "../services"; +import { NotificationService, RequestService, SettingsService, SonarrService } from "../services"; import { TreeNode } from "primeng/primeng"; import { IIssueCategory, IPagenator, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; @@ -29,6 +29,7 @@ export class TvRequestsComponent implements OnInit { public isAdmin: boolean; public showChildDialogue = false; // This is for the child modal popup public selectedSeason: ITvRequests; + public defaultPoster: string; @Input() public issueCategories: IIssueCategory[]; @Input() public issuesEnabled: boolean; @@ -49,7 +50,8 @@ export class TvRequestsComponent implements OnInit { private sanitizer: DomSanitizer, private imageService: ImageService, private sonarrService: SonarrService, - private notificationService: NotificationService) { + private notificationService: NotificationService, + private settingsService: SettingsService) { this.searchChanged .debounceTime(600) // Wait Xms after the last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -66,6 +68,12 @@ export class TvRequestsComponent implements OnInit { this.tvRequests.forEach((val) => this.setOverride(val.data)); }); }); + this.defaultPoster = "../../../images/default_tv_poster.png" + this.settingsService.getOmbi().subscribe(x => { + if (x.baseUrl) { + this.defaultPoster = "../../.." + x.baseUrl + "/images/default_tv_poster.png"; + } + }); } public openClosestTab(el: any) { @@ -222,7 +230,7 @@ export class TvRequestsComponent implements OnInit { private setDefaults(val: any) { if (val.data.posterPath === null) { - val.data.posterPath = "../../../images/default_tv_poster.png"; + val.data.posterPath = this.defaultPoster; } } diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 0abc10474..292eb7bb1 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -8,7 +8,7 @@ import { Subject } from "rxjs/Subject"; import { AuthService } from "../auth/auth.service"; import { IIssueCategory, IRequestEngineResult, ISearchMovieResult } from "../interfaces"; -import { NotificationService, RequestService, SearchService } from "../services"; +import { NotificationService, RequestService, SearchService, SettingsService } from "../services"; @Component({ selector: "movie-search", @@ -29,10 +29,12 @@ export class MovieSearchComponent implements OnInit { public issueRequestId: number; public issueProviderId: string; public issueCategorySelected: IIssueCategory; + public defaultPoster: string; constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService, private authService: AuthService, - private readonly translate: TranslateService, private sanitizer: DomSanitizer) { + private readonly translate: TranslateService, private sanitizer: DomSanitizer, + private settingsService: SettingsService) { this.searchChanged .debounceTime(600) // Wait Xms after the last event before emitting last event @@ -52,6 +54,12 @@ export class MovieSearchComponent implements OnInit { this.getExtraInfo(); }); }); + this.defaultPoster = "../../../images/default_movie_poster.png" + this.settingsService.getOmbi().subscribe(x => { + if (x.baseUrl) { + this.defaultPoster = "../../.." + x.baseUrl + "/images/default_movie_poster.png"; + } + }); } public ngOnInit() { @@ -159,7 +167,7 @@ export class MovieSearchComponent implements OnInit { this.movieResults.forEach((val, index) => { if (val.posterPath === null) { - val.posterPath = "../../../images/default_movie_poster.png"; + val.posterPath = this.defaultPoster; } else { val.posterPath = "https://image.tmdb.org/t/p/w300/" + val.posterPath; } diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index bb30810e4..770ff483d 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -3,7 +3,7 @@ import { DomSanitizer } from "@angular/platform-browser"; import { Subject } from "rxjs/Subject"; import { AuthService } from "../auth/auth.service"; -import { ImageService, NotificationService, RequestService, SearchService} from "../services"; +import { ImageService, NotificationService, RequestService, SearchService, SettingsService } from "../services"; import { TreeNode } from "primeng/primeng"; import { IRequestEngineResult } from "../interfaces"; @@ -21,6 +21,7 @@ export class TvSearchComponent implements OnInit { public tvResults: TreeNode[]; public result: IRequestEngineResult; public searchApplied = false; + public defaultPoster: string; @Input() public issueCategories: IIssueCategory[]; @Input() public issuesEnabled: boolean; @@ -32,7 +33,8 @@ export class TvSearchComponent implements OnInit { constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService, private authService: AuthService, - private imageService: ImageService, private sanitizer: DomSanitizer) { + private imageService: ImageService, private sanitizer: DomSanitizer, + private settingsService: SettingsService) { this.searchChanged .debounceTime(600) // Wait Xms after the last event before emitting last event @@ -50,6 +52,12 @@ export class TvSearchComponent implements OnInit { this.getExtraInfo(); }); }); + this.defaultPoster = "../../../images/default_tv_poster.png" + this.settingsService.getOmbi().subscribe(x => { + if (x.baseUrl) { + this.defaultPoster = "../../.." + x.baseUrl + "/images/default_tv_poster.png"; + } + }); } public openClosestTab(el: any) { el.preventDefault(); @@ -228,7 +236,7 @@ export class TvSearchComponent implements OnInit { private setDefaults(x: any) { if (x.data.banner === null) { - x.data.banner = "../../../images/default_tv_poster.png"; + x.data.banner = this.defaultPoster; } if (x.data.imdbId === null) {