diff --git a/src/Base/Framework/Controller/IndexController.php b/src/Base/Framework/Controller/IndexController.php index 928d3a7..5eb3329 100644 --- a/src/Base/Framework/Controller/IndexController.php +++ b/src/Base/Framework/Controller/IndexController.php @@ -2,12 +2,14 @@ namespace App\Base\Framework\Controller; +use App\Monitor\Action\Command\MonitorTvShowCommand; use App\Monitor\Action\Handler\MonitorTvShowHandler; use App\Tmdb\TmdbClient; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Mailer\MailerInterface; +use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Mime\Email; use Symfony\Component\Routing\Attribute\Route; @@ -46,8 +48,9 @@ final class IndexController extends AbstractController } #[Route('/test')] - public function monitorTvShow(): Response + public function monitorTvShow(MonitorTvShowHandler $handler): Response { +// $handler->handle(new MonitorTvShowCommand(82)); return $this->render('index/test.html.twig', []); } } diff --git a/src/Torrentio/Client/Torrentio.php b/src/Torrentio/Client/Torrentio.php index dc2d62b..6489127 100644 --- a/src/Torrentio/Client/Torrentio.php +++ b/src/Torrentio/Client/Torrentio.php @@ -17,7 +17,7 @@ class Torrentio $results = $this->client->get($imdbCode, $cacheTags); if (true === $parseResults) { - return $this->parse($results); + return $this->parse($results, $imdbCode); } return $results; @@ -33,13 +33,13 @@ class Torrentio } if (true === $parseResults) { - return $this->parse($results); + return $this->parse($results, $imdbId); } return $results; } - public function parse(array $data): array + public function parse(array $data, string $imdbId): array { $results = []; foreach ($data['streams'] as $stream) { @@ -59,7 +59,8 @@ class Torrentio $result = ResultFactory::map( $stream['url'], $stream['title'], - $bingeGroup + $bingeGroup, + $imdbId ); $results[] = $result; diff --git a/src/Torrentio/Result/ResultFactory.php b/src/Torrentio/Result/ResultFactory.php index d877219..2fa8add 100644 --- a/src/Torrentio/Result/ResultFactory.php +++ b/src/Torrentio/Result/ResultFactory.php @@ -18,7 +18,8 @@ class ResultFactory public static function map( string $url, string $title, - string $bingeGroup = "-" + string $bingeGroup = "-", + string $imdbId = "-", ) { $ptn = (object) (new PTN())->parse($title); return new TorrentioResult( @@ -40,7 +41,8 @@ class ResultFactory self::setLanguages($title), self::setLanguageFlags($title), false, - uniqid() + uniqid(), + $imdbId, ); } diff --git a/src/Torrentio/Result/TorrentioResult.php b/src/Torrentio/Result/TorrentioResult.php index 0511d8a..6dbf4b2 100644 --- a/src/Torrentio/Result/TorrentioResult.php +++ b/src/Torrentio/Result/TorrentioResult.php @@ -23,6 +23,7 @@ class TorrentioResult public ?array $languages = [], public ?string $languageFlags = "-", public ?bool $selected = false, - public ?string $localId = "-" + public ?string $localId = "-", + public ?string $imdbId = "-", ) {} } diff --git a/templates/torrentio/partial/option-table.html.twig b/templates/torrentio/partial/option-table.html.twig index 1f936b9..7594ab3 100644 --- a/templates/torrentio/partial/option-table.html.twig +++ b/templates/torrentio/partial/option-table.html.twig @@ -52,7 +52,7 @@ provider="{{ result.provider }}" languages="{{ result.languages|json_encode }}" media-type="{{ results.media.mediaType }}" - imdb-id="{{ results.media.imdbId }}" + imdb-id="{{ result.imdbId }}" filename="{{ result.filename }}" data-local-id="{{ result.localId }}" {% if "tvshows" == results.media.mediaType %}