*/ class GetTvShowOptionsHandler implements HandlerInterface { public function __construct( private readonly TmdbClient $tmdb, private readonly Torrentio $torrentio, private readonly MediaFiles $mediaFiles, ) {} public function handle(CommandInterface $command): ResultInterface { $media = $this->tmdb->tvEpisodeDetails($command->tmdbId, $command->imdbId, $command->season, $command->episode); $parentShow = $this->tmdb->tvshowDetails($command->imdbId); $file = $this->mediaFiles->episodeExists($parentShow->title, $command->season, $command->episode); return new GetTvShowOptionsResult( parentShow: $parentShow, media: $media, file: MediaFileDto::fromSplFileInfo($file), season: $command->season, episode: $command->episode, results: $this->torrentio->fetchEpisodeResults( $command->imdbId, $command->season, $command->episode, ) ); } }