diff --git a/src/Monitor/Framework/Controller/WebController.php b/src/Monitor/Framework/Controller/WebController.php index 044fcf4..686a161 100644 --- a/src/Monitor/Framework/Controller/WebController.php +++ b/src/Monitor/Framework/Controller/WebController.php @@ -9,6 +9,9 @@ use App\Monitor\Action\Input\AddMonitorInput; use App\Monitor\Action\Input\DeleteMonitorInput; use App\Monitor\Framework\Entity\Monitor; use App\Monitor\Framework\Repository\MonitorRepository; +use App\Search\Action\Command\GetMediaInfoCommand; +use App\Search\Action\Handler\GetMediaInfoHandler; +use App\Tmdb\TmdbClient; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -37,10 +40,17 @@ class WebController extends AbstractController } #[Route('/monitors/{id}', name: 'app.monitor.view', methods: ['GET'])] - public function viewMonitor(Monitor $monitor) + public function viewMonitor(Monitor $monitor, GetMediaInfoHandler $getMediaInfoHandler) { + $media = $getMediaInfoHandler->handle( + new GetMediaInfoCommand( + imdbId: $monitor->getImdbId(), + mediaType: 'tvshows', + ) + ); return $this->render('monitor/view.html.twig', [ 'monitor' => $monitor, + 'results' => $media, ]); } } diff --git a/templates/components/MonitorListRow.html.twig b/templates/components/MonitorListRow.html.twig index 9a10a9e..23e77e8 100644 --- a/templates/components/MonitorListRow.html.twig +++ b/templates/components/MonitorListRow.html.twig @@ -1,4 +1,4 @@ - +
+ {% if results.media.poster != null %} + + {% else %} +
+ +
+ {% endif %} + +
+
+

+ {{ results.media.title }} ({{ results.media.year }}) +

+
+ +

+ {{ results.media.description }} +

+ +
+ {% if results.media.stars != null %} + Starring: {{ results.media.stars|join(', ') }}
+ {% endif %} + + {% if results.media.directors != null %} + Directors: {{ results.media.directors|join(', ') }}
+ {% endif %} + + {% if results.media.producers != null %} + Producers: {{ results.media.producers|join(', ') }}
+ {% endif %} + + {% if results.media.creators != null %} + Creators: {{ results.media.creators|join(', ') }}
+ {% endif %} + + {% if results.media.genres != null %} +
+ {% for genre in results.media.genres %} + {{ genre }} + {% endfor %} +
+ {% endif %} +
+ + {% if results.media.mediaType == "tvshows" %} +
+ + {{ results.media.numberSeasons }} season(s) + + + {{ results.media.premiereDate|date(null, 'UTC') }} + +
+ {% endif %} + + {% if "movies" == results.media.mediaType %} +
+ + - results + + + + + missing + + + + + {{ results.media.premiereDate|date('n/j/Y', 'UTC') }} + + + + {{ results.media.runtime }} minutes + +
+ {% endif %} +
+
+