1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-14 22:22:39 +01:00

region query for upcoming movies (#69)

This commit is contained in:
Viktor Geringer 2017-04-11 14:42:36 +02:00 committed by GitHub
parent 342683adeb
commit d398126664
2 changed files with 15 additions and 6 deletions

View File

@ -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'));
});

View File

@ -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';
}
},