From fe0eee4dda7a43658b41289632a3e9e64921c1fb Mon Sep 17 00:00:00 2001 From: dr3amer <91037083+dr3am37@users.noreply.github.com> Date: Wed, 4 May 2022 22:13:59 -0700 Subject: [PATCH] missingPosterFix added checks and string formatting in the case of having a missing poster on tmdb to both tv and movies, removed the hard coded tmdb url from the html template and moved into component. --- .../components/movie/movie-details.component.html | 6 +++--- .../components/movie/movie-details.component.ts | 11 ++++++++++- .../components/tv/tv-details.component.html | 4 ++-- .../components/tv/tv-details.component.ts | 10 +++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html index 2207ea323..282683fed 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html @@ -24,7 +24,7 @@
- +
@@ -107,7 +107,7 @@ - +
\ No newline at end of file + diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts index c040fe4e0..079af8db5 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts @@ -68,6 +68,7 @@ export class MovieDetailsComponent implements OnInit{ if (this.imdbId) { this.searchService.getMovieByImdbId(this.imdbId).subscribe(async x => { this.movie = x; + this.checkPoster(); if (this.movie.requestId > 0) { // Load up this request this.hasRequest = true; @@ -78,6 +79,7 @@ export class MovieDetailsComponent implements OnInit{ } else { this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => { this.movie = x; + this.checkPoster(); if (this.movie.requestId > 0) { // Load up this request this.hasRequest = true; @@ -272,7 +274,14 @@ export class MovieDetailsComponent implements OnInit{ } }); } - + private checkPoster() { + if (this.movie.posterPath == null) { + this.movie.posterPath = "../../../images/default_movie_poster.png"; + } + else { + this.movie.posterPath = "https://image.tmdb.org/t/p/w300/" + this.movie.posterPath + }; + } private loadAdvancedInfo() { const profile = this.radarrService.getQualityProfilesFromSettings(); const folders = this.radarrService.getRootFoldersFromSettings(); diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html index cb1ec6ffb..0ae1ae499 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html @@ -42,7 +42,7 @@

{{ 'MediaDetails.NotEnoughInfo' | translate }}

- +
@@ -82,7 +82,7 @@

{{ 'MediaDetails.NotEnoughInfo' | translate }}

class="btn-spacing" color="accent" [disabled]> {{'Common.PartiallyAvailable' | translate }} - + diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts index 2d02dc63b..473417d53 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts @@ -48,6 +48,7 @@ export class TvDetailsComponent implements OnInit { public async ngOnInit() { await this.load(); + this.checkPoster(); } public async load() { @@ -128,7 +129,14 @@ export class TvDetailsComponent implements OnInit { public allEpisodesRequested(): boolean { return this.tv.seasonRequests.every(e => e.episodes.every(x => x.approved || x.requested)); } - + private checkPoster() { + if (this.tv.images.original == null) { + this.tv.images.original = "../../../images/default_movie_poster.png"; + } + else { + this.tv.images.original = 'https://image.tmdb.org/t/p/w300/' + this.tv.images.original + }; + } private loadAdvancedInfo() { const profile = this.sonarrService.getQualityProfilesWithoutSettings(); const folders = this.sonarrService.getRootFoldersWithoutSettings();