diff --git a/src/Console/Command/TorrentsSearchMoviesCommand.php b/src/Console/Command/TorrentsSearchMoviesCommand.php new file mode 100644 index 0000000..9e3c431 --- /dev/null +++ b/src/Console/Command/TorrentsSearchMoviesCommand.php @@ -0,0 +1,50 @@ +setName('torrents:search:movies') + ->setDescription('Search movies') + ->addArgument('query', InputArgument::REQUIRED, 'Query') + ->addOption('offset', 'o', InputOption::VALUE_REQUIRED, 'Page number') + ->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Number of results per page') + ->addOption('terms', 't', InputOption::VALUE_REQUIRED, 'Filter by terms IDs (separated by ",")') + ->setHelp("%command.name% + +Search movies. + +Usage: torrents:search:movies QUERY [OPTIONS] + +--terms does not work (API bug)"); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $inputData = array( + 'command' => 'torrents:search', + 'query' => $input->getArgument('query'), + '--sub-category' => 631, + ); + + foreach (['offset', 'limit', 'terms'] as $p) { + $value = $input->getOption($p); + + if (null !== $value) { + $inputData['--'.$p] = $value; + } + } + + return $this->getApplication()->doRun(new ArrayInput($inputData), $output); + } +} diff --git a/src/Console/Command/TorrentsSearchSeriesCommand.php b/src/Console/Command/TorrentsSearchSeriesCommand.php new file mode 100644 index 0000000..ccb2dc3 --- /dev/null +++ b/src/Console/Command/TorrentsSearchSeriesCommand.php @@ -0,0 +1,50 @@ +setName('torrents:search:series') + ->setDescription('Search series') + ->addArgument('query', InputArgument::REQUIRED, 'Query') + ->addOption('offset', 'o', InputOption::VALUE_REQUIRED, 'Page number') + ->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Number of results per page') + ->addOption('terms', 't', InputOption::VALUE_REQUIRED, 'Filter by terms IDs (separated by ",")') + ->setHelp("%command.name% + +Search series. + +Usage: torrents:search:series QUERY [OPTIONS] + +--terms does not work (API bug)"); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $inputData = array( + 'command' => 'torrents:search', + 'query' => $input->getArgument('query'), + '--sub-category' => 433, + ); + + foreach (['offset', 'limit', 'terms'] as $p) { + $value = $input->getOption($p); + + if (null !== $value) { + $inputData['--'.$p] = $value; + } + } + + return $this->getApplication()->doRun(new ArrayInput($inputData), $output); + } +}