mirror of
https://github.com/devfake/flox.git
synced 2024-11-15 06:32:34 +01:00
region query for upcoming movies (#69)
This commit is contained in:
parent
342683adeb
commit
d398126664
@ -97,14 +97,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search TMDb for upcoming movies.
|
* Search TMDb for upcoming movies in our region.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function upcoming()
|
public function upcoming()
|
||||||
{
|
{
|
||||||
$cache = Cache::remember('upcoming', $this->untilEndOfDay(), function() {
|
$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'));
|
return collect($this->createItems($response, 'movie'));
|
||||||
});
|
});
|
||||||
|
@ -121,6 +121,10 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
posterImage() {
|
posterImage() {
|
||||||
|
if( ! this.item.poster) {
|
||||||
|
return this.noImage;
|
||||||
|
}
|
||||||
|
|
||||||
if(this.item.rating != null) {
|
if(this.item.rating != null) {
|
||||||
return config.posterSubpage + this.item.poster;
|
return config.posterSubpage + this.item.poster;
|
||||||
}
|
}
|
||||||
@ -128,14 +132,14 @@
|
|||||||
return config.posterSubpageTMDB + this.item.poster;
|
return config.posterSubpageTMDB + this.item.poster;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
noImage() {
|
||||||
|
return config.url + '/assets/img/no-image-subpage.png';
|
||||||
|
},
|
||||||
|
|
||||||
released() {
|
released() {
|
||||||
const released = new Date(this.item.released * 1000);
|
const released = new Date(this.item.released * 1000);
|
||||||
|
|
||||||
return released.getFullYear();
|
return released.getFullYear();
|
||||||
},
|
|
||||||
|
|
||||||
noImage() {
|
|
||||||
return config.url + '/assets/img/no-image-subpage.png';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user