Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 937e3c6270 | |||
| 2bb2845ead |
@@ -129,7 +129,7 @@ readonly class MonitorTvShowHandler implements HandlerInterface
|
|||||||
{
|
{
|
||||||
static $today = Carbon::today();
|
static $today = Carbon::today();
|
||||||
$episodeAirDate = Carbon::parse($episodeInShow['air_date']);
|
$episodeAirDate = Carbon::parse($episodeInShow['air_date']);
|
||||||
return $episodeAirDate > $today;
|
return $episodeAirDate >= $today;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function episodeExists(array $episodeInShow, Map $downloadedEpisodes): bool
|
private function episodeExists(array $episodeInShow, Map $downloadedEpisodes): bool
|
||||||
|
|||||||
@@ -38,11 +38,21 @@ class Torrentio
|
|||||||
|
|
||||||
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode) {
|
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode) {
|
||||||
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
||||||
$response = file_get_contents(str_replace('{imdbCode}', $imdbCode, $this->searchUrl));
|
try {
|
||||||
return json_decode(
|
$response = $this->client->get("$this->searchUrl/$imdbCode.json");
|
||||||
$response,
|
return json_decode(
|
||||||
true
|
$response->getBody()->getContents(),
|
||||||
);
|
true
|
||||||
|
);
|
||||||
|
} catch (\Throwable $exception) {
|
||||||
|
if ($exception->getCode() === 429) {
|
||||||
|
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
|
||||||
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->parse($results, $filter);
|
return $this->parse($results, $filter);
|
||||||
|
|||||||
Reference in New Issue
Block a user