feat: torrentio api for movie results

This commit is contained in:
2025-04-21 16:11:57 -05:00
parent 77907601f8
commit fb4651c925
14 changed files with 210 additions and 13 deletions

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Torrentio\Action\Command;
use OneToMany\RichBundle\Contract\CommandInterface;
class GetMovieOptionsCommand implements CommandInterface
{
public function __construct(
public string $imdbId,
) {}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Torrentio\Action\Handler;
use App\Torrentio\Action\Result\GetMovieOptionsResult;
use App\Torrentio\Client\Torrentio;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\HandlerInterface;
use OneToMany\RichBundle\Contract\ResultInterface;
class GetMovieOptionsHandler implements HandlerInterface
{
public function __construct(
private readonly Torrentio $torrentio,
) {}
public function handle(CommandInterface $command): ResultInterface
{
return new GetMovieOptionsResult(
results: $this->torrentio->search($command->imdbId, 'movies')
);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Torrentio\Action\Input;
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
use OneToMany\RichBundle\Attribute\SourceRoute;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\InputInterface;
class GetMovieOptionsInput implements InputInterface
{
public function __construct(
#[SourceRoute('imdbId')]
public string $imdbId,
) {}
public function toCommand(): CommandInterface
{
return new GetMovieOptionsCommand($this->imdbId);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Torrentio\Action\Result;
use OneToMany\RichBundle\Contract\ResultInterface;
class GetMovieOptionsResult implements ResultInterface
{
public function __construct(
public array $results
) {}
}

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Torrentio\Rule\DownloadOptionFilter;
namespace App\Torrentio\Client\Rule\DownloadOptionFilter;
use App\Torrentio\Result\ResultFactory;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Torrentio\Rule;
namespace App\Torrentio\Client\Rule;
class RuleEngine
{

View File

@@ -1,9 +1,10 @@
<?php
namespace App\Torrentio;
namespace App\Torrentio\Client;
use App\Torrentio\Rule\DownloadOptionFilter\Resolution;
use App\Torrentio\Rule\RuleEngine;
use App\Torrentio\Client\Rule\DownloadOptionFilter\Resolution;
use App\Torrentio\Client\Rule\RuleEngine;
use App\Torrentio\MediaResult;
use App\Torrentio\Result\ResultFactory;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Contracts\Cache\CacheInterface;