Add db, sync movies command

This commit is contained in:
thibaud-leclere
2026-01-14 00:54:49 +01:00
parent e5d5fe4343
commit 5c35aff23b
11 changed files with 264 additions and 32 deletions

View File

@@ -7,7 +7,6 @@ namespace App\Controller;
use App\Gateway\TMDBGateway;
use App\Model\Ltbxd\LtbxdMovie;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\SerializerInterface;
@@ -21,16 +20,17 @@ class HomepageController extends AbstractController
#[Route('/')]
public function index(SerializerInterface $serializer): Response
{
$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
$searchResult = $this->TMDBGateway->searchMovie($ltbxdMovie->getName());
$films[] = $searchResult->getResults()[0];
}
dd($films);
// $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;
// }
// }
return $this->render('homepage/index.html.twig');
}