Compare commits

...

2 Commits

2 changed files with 16 additions and 6 deletions

View File

@@ -129,7 +129,7 @@ readonly class MonitorTvShowHandler implements HandlerInterface
{
static $today = Carbon::today();
$episodeAirDate = Carbon::parse($episodeInShow['air_date']);
return $episodeAirDate > $today;
return $episodeAirDate >= $today;
}
private function episodeExists(array $episodeInShow, Map $downloadedEpisodes): bool

View File

@@ -38,11 +38,21 @@ class Torrentio
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode) {
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
$response = file_get_contents(str_replace('{imdbCode}', $imdbCode, $this->searchUrl));
return json_decode(
$response,
true
);
try {
$response = $this->client->get("$this->searchUrl/$imdbCode.json");
return json_decode(
$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);