fix: moves monitor logic into own directory
This commit is contained in:
@@ -30,6 +30,12 @@ doctrine:
|
||||
dir: '%kernel.project_dir%/src/User/Framework/Entity'
|
||||
prefix: 'App\User\Framework\Entity'
|
||||
alias: User
|
||||
Monitor:
|
||||
type: attribute
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/Monitor/Framework/Entity'
|
||||
prefix: 'App\Monitor\Framework\Entity'
|
||||
alias: Download
|
||||
controller_resolver:
|
||||
auto_mapping: false
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ framework:
|
||||
# Route your messages to the transports
|
||||
# 'App\Message\YourMessage': async
|
||||
'App\Download\Action\Command\DownloadMediaCommand': async
|
||||
'App\Download\Action\Command\MonitorTvEpisodeCommand': async
|
||||
'App\Download\Action\Command\MonitorTvSeasonCommand': async
|
||||
'App\Download\Action\Command\MonitorTvShowCommand': async
|
||||
'App\Download\Action\Command\MonitorMovieCommand': async
|
||||
'App\Monitor\Action\Command\MonitorTvEpisodeCommand': async
|
||||
'App\Monitor\Action\Command\MonitorTvSeasonCommand': async
|
||||
'App\Monitor\Action\Command\MonitorTvShowCommand': async
|
||||
'App\Monitor\Action\Command\MonitorMovieCommand': async
|
||||
|
||||
# when@test:
|
||||
# framework:
|
||||
|
||||
@@ -14,10 +14,10 @@ controllersUser:
|
||||
defaults:
|
||||
schemes: ['https']
|
||||
|
||||
controllersDownload:
|
||||
controllersMonitor:
|
||||
resource:
|
||||
path: ../src/Download/Framework/Controller
|
||||
namespace: App\Download\Framework\Controller
|
||||
path: ../src/Monitor/Framework/Controller
|
||||
namespace: App\Monitor\Framework\Controller
|
||||
type: attribute
|
||||
defaults:
|
||||
schemes: ['https']
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Command;
|
||||
namespace App\Monitor\Action\Command;
|
||||
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
|
||||
class AddMonitorCommand implements CommandInterface
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Command;
|
||||
namespace App\Monitor\Action\Command;
|
||||
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Command;
|
||||
namespace App\Monitor\Action\Command;
|
||||
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Command;
|
||||
namespace App\Monitor\Action\Command;
|
||||
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Command;
|
||||
namespace App\Monitor\Action\Command;
|
||||
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Handler;
|
||||
namespace App\Monitor\Action\Handler;
|
||||
|
||||
use App\Download\Action\Command\AddMonitorCommand;
|
||||
use App\Download\Action\Result\AddMonitorResult;
|
||||
use App\Download\Action\Result\MonitorMovieResult;
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Action\Command\AddMonitorCommand;
|
||||
use App\Monitor\Action\Result\AddMonitorResult;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\User\Framework\Repository\UserRepository;
|
||||
use DateTimeImmutable;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Handler;
|
||||
namespace App\Monitor\Action\Handler;
|
||||
|
||||
use App\Download\Action\Command\DownloadMediaCommand;
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Download\Action\Result\MonitorMovieResult;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Download\Service\MonitorOptionEvaluator;
|
||||
use App\Monitor\Action\Command\DownloadMediaCommand;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Result\MonitorMovieResult;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Service\MonitorOptionEvaluator;
|
||||
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
||||
use App\Torrentio\Action\Handler\GetMovieOptionsHandler;
|
||||
use DateTimeImmutable;
|
||||
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Handler;
|
||||
namespace App\Monitor\Action\Handler;
|
||||
|
||||
use App\Download\Action\Command\DownloadMediaCommand;
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Download\Action\Result\MonitorMovieResult;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Download\Service\MonitorOptionEvaluator;
|
||||
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
||||
use App\Monitor\Action\Command\DownloadMediaCommand;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Result\MonitorMovieResult;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Service\MonitorOptionEvaluator;
|
||||
use App\Torrentio\Action\Command\GetTvShowOptionsCommand;
|
||||
use App\Torrentio\Action\Handler\GetMovieOptionsHandler;
|
||||
use App\Torrentio\Action\Handler\GetTvShowOptionsHandler;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -1,20 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Handler;
|
||||
namespace App\Monitor\Action\Handler;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\Download\Action\Command\DownloadMediaCommand;
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Download\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Download\Action\Command\MonitorTvSeasonCommand;
|
||||
use App\Download\Action\Result\MonitorMovieResult;
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Download\Service\MediaFiles;
|
||||
use App\Download\Service\MonitorOptionEvaluator;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Monitor\Action\Result\MonitorMovieResult;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Service\MediaFiles;
|
||||
use App\Tmdb\Tmdb;
|
||||
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
||||
use App\Torrentio\Action\Handler\GetMovieOptionsHandler;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nihilarr\PTN;
|
||||
@@ -1,21 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Handler;
|
||||
namespace App\Monitor\Action\Handler;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\Download\Action\Command\DownloadMediaCommand;
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Download\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Download\Action\Command\MonitorTvSeasonCommand;
|
||||
use App\Download\Action\Result\MonitorMovieResult;
|
||||
use App\Download\Action\Result\MonitorTvEpisodeResult;
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Download\Service\MediaFiles;
|
||||
use App\Download\Service\MonitorOptionEvaluator;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Monitor\Action\Result\MonitorTvEpisodeResult;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Service\MediaFiles;
|
||||
use App\Tmdb\Tmdb;
|
||||
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
||||
use App\Torrentio\Action\Handler\GetMovieOptionsHandler;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nihilarr\PTN;
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Input;
|
||||
namespace App\Monitor\Action\Input;
|
||||
|
||||
use App\Download\Action\Command\AddMonitorCommand;
|
||||
use App\Monitor\Action\Command\AddMonitorCommand;
|
||||
use OneToMany\RichBundle\Attribute\SourceRequest;
|
||||
use OneToMany\RichBundle\Attribute\SourceRoute;
|
||||
use OneToMany\RichBundle\Attribute\SourceSecurity;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
use OneToMany\RichBundle\Contract\InputInterface;
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Input;
|
||||
namespace App\Monitor\Action\Input;
|
||||
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use OneToMany\RichBundle\Attribute\SourceRoute;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
use OneToMany\RichBundle\Contract\InputInterface;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Result;
|
||||
namespace App\Monitor\Action\Result;
|
||||
|
||||
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Result;
|
||||
namespace App\Monitor\Action\Result;
|
||||
|
||||
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Action\Result;
|
||||
namespace App\Monitor\Action\Result;
|
||||
|
||||
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Framework\Controller;
|
||||
namespace App\Monitor\Framework\Controller;
|
||||
|
||||
use App\Download\Action\Handler\AddMonitorHandler;
|
||||
use App\Download\Action\Input\AddMonitorInput;
|
||||
use App\Monitor\Action\Handler\AddMonitorHandler;
|
||||
use App\Monitor\Action\Input\AddMonitorInput;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
0
src/Monitor/Framework/Entity/.gitignore
vendored
Normal file
0
src/Monitor/Framework/Entity/.gitignore
vendored
Normal file
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Framework\Entity;
|
||||
namespace App\Monitor\Framework\Entity;
|
||||
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\User\Framework\Entity\User;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Ignore;
|
||||
use Symfony\Component\Serializer\Attribute\MaxDepth;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MonitorRepository::class)]
|
||||
class Monitor
|
||||
0
src/Monitor/Framework/Repository/.gitignore
vendored
Normal file
0
src/Monitor/Framework/Repository/.gitignore
vendored
Normal file
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Framework\Repository;
|
||||
namespace App\Monitor\Framework\Repository;
|
||||
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Framework\Scheduler;
|
||||
namespace App\Monitor\Framework\Scheduler;
|
||||
|
||||
use App\Download\Action\Command\MonitorMovieCommand;
|
||||
use App\Download\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Download\Action\Command\MonitorTvSeasonCommand;
|
||||
use App\Download\Action\Command\MonitorTvShowCommand;
|
||||
use App\Download\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Command\MonitorTvEpisodeCommand;
|
||||
use App\Monitor\Action\Command\MonitorTvSeasonCommand;
|
||||
use App\Monitor\Action\Command\MonitorTvShowCommand;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Scheduler\Attribute\AsCronTask;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Service;
|
||||
namespace App\Monitor\Service;
|
||||
|
||||
use Aimeos\Map;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
@@ -61,7 +61,7 @@ class MediaFiles
|
||||
if (!str_starts_with($path, $this->tvShowsPath)) {
|
||||
$path = $this->tvShowsPath . DIRECTORY_SEPARATOR . $path;
|
||||
}
|
||||
|
||||
|
||||
$results = [];
|
||||
foreach ($this->finder->in($path)->files() as $file) {
|
||||
if ($onlyFilenames) {
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Service;
|
||||
namespace App\Monitor\Service;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\Torrentio\Result\TorrentioResult;
|
||||
|
||||
class MonitorOptionEvaluator
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\User\Framework\Entity;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\Download\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\User\Framework\Repository\UserRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
Reference in New Issue
Block a user