38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use App\Data\InputData;
|
|
use App\Exceptions\Quit;
|
|
use App\Services\ProcessInput;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
class GetShow extends Command
|
|
{
|
|
protected $signature = 'get:show ' .
|
|
'{--i|input=* : Input files} ' .
|
|
'{--u|url= : URL to download} ' .
|
|
'{--d|destination= : Directory of show} ' .
|
|
'{--t|title= : The title of the episode} ' .
|
|
'{--l|low : Put on low priority queue}' .
|
|
'{--s|sync : Run synchronously}'
|
|
;
|
|
|
|
protected $description = 'Queue a show to re-encode or download';
|
|
|
|
public function handle(): int
|
|
{
|
|
$this->line('Options: ' . json_encode($this->options()), verbosity: OutputInterface::VERBOSITY_DEBUG);
|
|
$input = $this->getInput();
|
|
$this->line('Input: ' . json_encode($input), verbosity: OutputInterface::VERBOSITY_DEBUG);
|
|
$job = app()->make(ProcessInput::class)->getJob($input);
|
|
$this->line('Job: ' . json_encode($job), verbosity: OutputInterface::VERBOSITY_DEBUG);
|
|
|
|
return static::SUCCESS;
|
|
}
|
|
|
|
protected function getInput(): InputData
|
|
{
|
|
return InputData::from($this->options())->assertValid();
|
|
}
|
|
}
|