Example #1
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Get all posts
     $posts = $this->reader->findAll();
     // Create a new progress bar
     $progress = new ProgressBar($output, count($posts));
     $progress->start();
     // For each post, resolve the url and update webm/mp4 urls
     foreach ($posts as $post) {
         try {
             $video = $this->handler->resolve($post->getBaseUrl());
         } catch (InvalidUrlException $exception) {
             $output->writeln(sprintf('<error>%s</error>', $exception->getMessage()));
             continue;
         }
         $post->setWebmUrl($video->getWebmUrl());
         $post->setMp4Url($video->getMp4Url());
         $progress->advance();
     }
     $this->writer->save($posts);
     // Ensure that the progress bar is at 100%
     $progress->finish();
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function validate(Submission $submission)
 {
     $post = $this->createPostFromSubmission($submission);
     $this->postWriter->add($post);
     $this->submissionWriter->delete($submission);
 }