2026-01-13 12:58:53 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
|
|
|
|
use App\Gateway\TMDBGateway;
|
2026-01-13 20:26:00 +00:00
|
|
|
use App\Model\Ltbxd\LtbxdMovie;
|
2026-01-13 12:58:53 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
use Symfony\Component\Routing\Attribute\Route;
|
2026-01-13 20:26:00 +00:00
|
|
|
use Symfony\Component\Serializer\SerializerInterface;
|
2026-01-13 12:58:53 +00:00
|
|
|
|
|
|
|
|
class HomepageController extends AbstractController
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
2026-01-13 20:26:00 +00:00
|
|
|
private readonly TMDBGateway $TMDBGateway, private readonly SerializerInterface $serializer,
|
|
|
|
|
) {}
|
2026-01-13 12:58:53 +00:00
|
|
|
|
|
|
|
|
#[Route('/')]
|
2026-01-13 20:26:00 +00:00
|
|
|
public function index(SerializerInterface $serializer): Response
|
2026-01-13 12:58:53 +00:00
|
|
|
{
|
2026-01-13 23:54:49 +00:00
|
|
|
// $file = file_get_contents('files/watched.csv');
|
|
|
|
|
// $ltbxdMovies = $this->serializer->deserialize($file, LtbxdMovie::class.'[]', 'csv');
|
|
|
|
|
// /** @var LtbxdMovie $ltbxdMovie */
|
|
|
|
|
// $films = [];
|
|
|
|
|
// foreach ($ltbxdMovies as $ltbxdMovie) {
|
|
|
|
|
// // Search movie on TMDB
|
|
|
|
|
// $film = $this->TMDBGateway->searchMovie($ltbxdMovie->getName());
|
|
|
|
|
// if ($film) {
|
|
|
|
|
// $films[] = $film;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2026-01-13 12:58:53 +00:00
|
|
|
|
|
|
|
|
return $this->render('homepage/index.html.twig');
|
|
|
|
|
}
|
|
|
|
|
}
|