argument('guid'); $renamed = $this->argument('renamed') ?? ''; $mode = $this->option('mode') ?? 'pipeline'; if (! $this->isValidChar($guid)) { $this->error('GUID character must be a-f or 0-9.'); return self::FAILURE; } if (! in_array($mode, ['pipeline', 'parallel', 'laravel'], true)) { $this->error('Mode must be either "pipeline", "parallel", or "laravel".'); return self::FAILURE; } try { if ($mode === 'laravel') { // Use the new Laravel Pipeline-based processor $pipeline = TvProcessingPipeline::createDefault(echoOutput: true); $pipeline->process('', $guid, $renamed); } else { // Use the legacy processor for backward compatibility $tvProcessor = new TvProcessor(true); // true = echo output $tvProcessor->process('', $guid, $renamed, $mode); } return self::SUCCESS; } catch (\Throwable $e) { Log::error($e->getTraceAsString()); $this->error($e->getMessage()); return self::FAILURE; } } /** * Check if the character contains a-f or 0-9. */ private function isValidChar(string $char): bool { return \in_array( $char, ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], true ); } }