diff --git a/cutvideo b/cutvideo index 09a629b..ab10f34 100755 --- a/cutvideo +++ b/cutvideo @@ -15,6 +15,7 @@ use Symfony\Component\Console\SingleCommandApplication; ->addArgument('start', InputArgument::REQUIRED, 'The starting point of the video') ->addArgument('end', InputArgument::REQUIRED, 'The end point of the video') ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force generation, even if target already exists.') + ->addOption('remove', 'r', InputOption::VALUE_NONE, 'Remove input file on success.') ->addOption('ad', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Start and end of ads, separate start and end via "/".', []) ->setCode(new Command()) ->run(); diff --git a/src/Command.php b/src/Command.php index 5a52ea2..7998498 100644 --- a/src/Command.php +++ b/src/Command.php @@ -87,6 +87,10 @@ class Command $videoInfo->getTargetFilePath() )); + if ($input->getOption('remove')) { + $this->removeInputFile($videoInfo); + } + return 0; } @@ -128,4 +132,10 @@ class Command mkdir($target, 0775, true); } + + private function removeInputFile(VideoInfo $videoInfo) + { + $this->executeStep('Remove input file'); + unlink($videoInfo->getOriginalFilename()); + } }