feat: torrentio api for movie results
This commit is contained in:
12
src/Torrentio/Action/Command/GetMovieOptionsCommand.php
Normal file
12
src/Torrentio/Action/Command/GetMovieOptionsCommand.php
Normal 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,
|
||||
) {}
|
||||
}
|
||||
23
src/Torrentio/Action/Handler/GetMovieOptionsHandler.php
Normal file
23
src/Torrentio/Action/Handler/GetMovieOptionsHandler.php
Normal 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')
|
||||
);
|
||||
}
|
||||
}
|
||||
21
src/Torrentio/Action/Input/GetMovieOptionsInput.php
Normal file
21
src/Torrentio/Action/Input/GetMovieOptionsInput.php
Normal 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);
|
||||
}
|
||||
}
|
||||
12
src/Torrentio/Action/Result/GetMovieOptionsResult.php
Normal file
12
src/Torrentio/Action/Result/GetMovieOptionsResult.php
Normal 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
|
||||
) {}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Torrentio\Rule\DownloadOptionFilter;
|
||||
namespace App\Torrentio\Client\Rule\DownloadOptionFilter;
|
||||
|
||||
use App\Torrentio\Result\ResultFactory;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Torrentio\Rule;
|
||||
namespace App\Torrentio\Client\Rule;
|
||||
|
||||
class RuleEngine
|
||||
{
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user