vid-queue/app/Commands/GetShow.php

39 lines
1.3 KiB
PHP
Raw Normal View History

2022-03-03 22:55:57 -06:00
<?php
namespace App\Commands;
2022-08-19 19:52:56 -05:00
use App\Data\InputData;
2022-03-03 22:55:57 -06:00
use App\Exceptions\Quit;
2022-03-25 17:02:09 -05:00
use App\Services\ProcessInput;
use Symfony\Component\Console\Output\OutputInterface;
2022-03-03 22:55:57 -06:00
class GetShow extends Command
{
protected $signature = 'get:show ' .
'{--i|input=* : Input files} ' .
2022-03-05 19:51:04 -06:00
'{--u|url= : URL to download} ' .
2022-03-03 22:55:57 -06:00
'{--d|destination= : Directory of show} ' .
'{--t|title= : The title of the episode} ' .
2022-08-20 22:51:12 -05:00
'{--p|priority= : Specify priority of job}' .
2022-03-03 22:55:57 -06:00
'{--s|sync : Run synchronously}'
;
protected $description = 'Queue a show to re-encode or download';
public function handle(): int
{
2022-03-25 17:02:09 -05:00
$this->line('Options: ' . json_encode($this->options()), verbosity: OutputInterface::VERBOSITY_DEBUG);
2022-03-05 19:51:04 -06:00
$input = $this->getInput();
2022-03-25 17:02:09 -05:00
$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);
2022-03-03 22:55:57 -06:00
return static::SUCCESS;
}
2022-08-19 19:52:56 -05:00
protected function getInput(): InputData
2022-03-03 22:55:57 -06:00
{
2022-08-19 19:52:56 -05:00
return InputData::from($this->options())->assertValid();
2022-03-03 22:55:57 -06:00
}
}