fix: moves monitor logic into own directory

This commit is contained in:
2025-05-09 15:03:42 -05:00
parent 6c2cd7510f
commit 3724bcbb16
30 changed files with 76 additions and 131 deletions

View File

@@ -2,19 +2,8 @@
namespace App\Controller;
use App\Download\Action\Command\MonitorMovieCommand;
use App\Download\Action\Command\MonitorTvSeasonCommand;
use App\Download\Action\Command\MonitorTvShowCommand;
use App\Download\Action\Handler\MonitorMovieHandler;
use App\Download\Action\Handler\MonitorTvSeasonHandler;
use App\Download\Action\Handler\MonitorTvShowHandler;
use App\Download\Action\Input\DownloadMediaInput;
use App\Download\Framework\Entity\Monitor;
use App\Download\Framework\Repository\DownloadRepository;
use App\Download\Framework\Repository\MonitorRepository;
use App\Download\Service\MediaFiles;
use DateTimeImmutable;
use Nihilarr\PTN;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -25,35 +14,8 @@ class DownloadController extends AbstractController
public function __construct(
private DownloadRepository $downloadRepository,
private MessageBusInterface $bus,
private readonly MonitorRepository $monitorRepository,
) {}
#[Route('/test', name: 'app_test')]
public function test(
MonitorTvShowHandler $handler,
) {
$monitor = (new Monitor())
->setUser($this->getUser())
->setTmdbId('112442')
->setImdbId('tt9288860')
->setTitle('Trash Truck')
->setMonitorType('tvseason')
->setSeason(1)
->setEpisode(null)
->setCreatedAt(new DateTimeImmutable())
->setSearchCount(0)
->setStatus('New');
$this->monitorRepository->getEntityManager()->persist($monitor);
$this->monitorRepository->getEntityManager()->flush();
$command = new MonitorTvSeasonCommand($monitor->getId());
// $handler->handle($command);
return $this->json([
'status' => 200,
'message' => $command
]);
}
#[Route('/download', name: 'app_download', methods: ['POST'])]
public function download(
DownloadMediaInput $input,

View File

@@ -2,11 +2,7 @@
namespace App\Controller;
use App\Download\Action\Command\MonitorMovieCommand;
use App\Download\Action\Handler\MonitorMovieHandler;
use App\Download\Framework\Entity\Monitor;
use App\Download\Framework\Repository\DownloadRepository;
use App\Download\Framework\Repository\MonitorRepository;
use App\Tmdb\Tmdb;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

View File

@@ -10,6 +10,7 @@ use Carbon\Carbon;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
@@ -73,10 +74,7 @@ final class TorrentioController extends AbstractController
);
$cache->delete($cacheId);
$cacheId = sprintf("page.%s.%s", "tvshows", $input->tmdbId);
$cache->delete($cacheId);
$this->hub->publish(new \Symfony\Component\Mercure\Update(
$this->hub->publish(new Update(
'alerts',
$this->renderer->render('broadcast/Alert.html.twig', [
'alert_id' => uniqid(),