/** * @param WeburgClient $weburgClient * @param $movieId * @param $daysMax * @param $allowedMisses * @return array */ public function getMovieTorrentsUrls(WeburgClient $weburgClient, $movieId, $daysMax, $allowedMisses) { $torrentsUrls = []; $logger = $this->getApplication()->getLogger(); $movieId = $weburgClient->cleanMovieId($movieId); if (!$movieId) { throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL'); } $movieInfo = $weburgClient->getMovieInfoById($movieId); $logger->info('Search series ' . $movieId); if (!empty($movieInfo['hashes'])) { $seriesUrls = $weburgClient->getSeriesTorrents($movieId, $movieInfo['hashes'], $daysMax, $allowedMisses); $torrentsUrls = array_merge($torrentsUrls, $seriesUrls); if (count($seriesUrls)) { $logger->info('Download series ' . $movieId . ': ' . $movieInfo['title'] . ' (' . count($seriesUrls) . ')'); } } else { $torrentsUrls = array_merge($torrentsUrls, $weburgClient->getMovieTorrentUrlsById($movieId)); } return $torrentsUrls; }