Add option to remove input file on completion
This commit is contained in:
parent
93c22ce548
commit
566b73ee04
2 changed files with 11 additions and 0 deletions
1
cutvideo
1
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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue