From cdf5f5274fa030256be1c8dc44269acbaa3c7a0b Mon Sep 17 00:00:00 2001 From: Pablo Ogando Ferreira Date: Wed, 6 Mar 2024 11:53:23 +0100 Subject: [PATCH] PHPCsFixer --- Command/EstimatedStorageAccountCommand.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Command/EstimatedStorageAccountCommand.php b/Command/EstimatedStorageAccountCommand.php index 03b0722..35d61a0 100644 --- a/Command/EstimatedStorageAccountCommand.php +++ b/Command/EstimatedStorageAccountCommand.php @@ -5,8 +5,6 @@ namespace Pumukit\YoutubeBundle\Command; use Doctrine\ODM\MongoDB\DocumentManager; -use Pumukit\EncoderBundle\Document\Job; -use Pumukit\SchemaBundle\Document\MultimediaObject; use Pumukit\SchemaBundle\Document\Tag; use Pumukit\YoutubeBundle\Services\GoogleAccountService; use Symfony\Component\Console\Command\Command; @@ -28,6 +26,7 @@ final class EstimatedStorageAccountCommand extends Command private GoogleAccountService $googleAccountService; private $sumStorage; + public function __construct(DocumentManager $documentManager, GoogleAccountService $googleAccountService) { $this->documentManager = $documentManager; @@ -84,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'forMine' => true, ]; - if($input->getOption('live')){ + if ($input->getOption('live')) { $queryParams['eventType'] = 'live'; } @@ -124,14 +123,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int $url = $this->selectBestStreamFormat($downloadOptions); try { - $duration = $downloadOptions->getInfo()->durationSeconds; $bitrate = $url->bitrate; - $output->writeln('Duration: '.$duration . ' and bitrate: ' . $bitrate); + $output->writeln('Duration: '.$duration.' and bitrate: '.$bitrate); $storage = $duration * $bitrate; $this->sumStorage += $storage; } catch (\Exception $exception) { $output->writeln('There was error calculating storage video with title '.$item->snippet->title.' and id '.$videoId); + continue; } } catch (YouTubeException $e) { @@ -142,10 +141,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } while (null !== $nextPageToken); - $progressBar->finish(); $output->writeln(' '); - $output->writeln('Total storage: '. $this->sumStorage); + $output->writeln('Total storage: '.$this->sumStorage); return 0; }