From d398126664ee41c4166028f5d508a808c7c25d42 Mon Sep 17 00:00:00 2001 From: Viktor Geringer Date: Tue, 11 Apr 2017 14:42:36 +0200 Subject: [PATCH] region query for upcoming movies (#69) --- backend/app/Services/TMDB.php | 9 +++++++-- client/app/components/Content/Subpage.vue | 12 ++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/app/Services/TMDB.php b/backend/app/Services/TMDB.php index 8731a8b..4cbefd6 100644 --- a/backend/app/Services/TMDB.php +++ b/backend/app/Services/TMDB.php @@ -97,14 +97,19 @@ } /** - * Search TMDb for upcoming movies. + * Search TMDb for upcoming movies in our region. * * @return array */ public function upcoming() { $cache = Cache::remember('upcoming', $this->untilEndOfDay(), function() { - $response = $this->requestTmdb($this->base . '/3/movie/upcoming'); + // There is no 'EN' region in TMDb. + $region = strtolower($this->translation) == 'en' ? 'us' : $this->translation; + + $response = $this->requestTmdb($this->base . '/3/movie/upcoming', [ + 'region' => $region, + ]); return collect($this->createItems($response, 'movie')); }); diff --git a/client/app/components/Content/Subpage.vue b/client/app/components/Content/Subpage.vue index 24148a4..4023a84 100644 --- a/client/app/components/Content/Subpage.vue +++ b/client/app/components/Content/Subpage.vue @@ -121,6 +121,10 @@ }, posterImage() { + if( ! this.item.poster) { + return this.noImage; + } + if(this.item.rating != null) { return config.posterSubpage + this.item.poster; } @@ -128,14 +132,14 @@ return config.posterSubpageTMDB + this.item.poster; }, + noImage() { + return config.url + '/assets/img/no-image-subpage.png'; + }, + released() { const released = new Date(this.item.released * 1000); return released.getFullYear(); - }, - - noImage() { - return config.url + '/assets/img/no-image-subpage.png'; } },