Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->ouput = $output;
     $this->mediainfoWrapper = new MediainfoWrapper();
     $this->mediainfoWrapper->setBinPath($this->input->getOption('mediainfo-bin'));
     if ($input->getArgument('file')) {
         $this->doJob($input->getArgument('file'));
     }
     $dir = $input->getOption('file-dir');
     if (is_dir($dir)) {
         $finder = Finder::create();
         $finder->in($dir)->files()->name('/(' . implode('|', $this->mediainfoWrapper->getSupportedExtensionsForRead()) . ')$/');
         $files = iterator_to_array($finder);
         foreach ($files as $file) {
             /** @var SplFileInfo $file */
             $this->doJob($file->getRealPath());
         }
         $this->printFinalInfo($output);
     }
     if ($this->input->getOption('dump-command')) {
         $this->ouput->writeln($this->nativeCommandStack);
     }
     return 0;
 }